4 comments

the problem is that these properties are not defined in Express module - they are added dynamically in runtime. That's why WebStorm can't resolve them using static analysis.

express index.d.ts stubs don't have `post()` defined as well, plus, this declaration file doesn't export express (`e` is used instead), thus WebStorm can't match it with code and thus doesn't use it for completion

0

Elena Pogorelova I know this is an old post but can you tell me why intellisense for express working in VS code and not in WebStorm? To make it work in WebStorm I have to change import from 

const express = require('express')

to

const express = require('express').application

Then intellisense works.. There are also other packages where intellisense doesn't work like Sequelize where I also have to change import to .Sequelize at the end.. I'm not a fan of VS code but intellisense works better there then in WebStorm and keep in mind VS code is even free

 

0

>I know this is an old post but can you tell me why intellisense for express working in VS code and not in WebStorm? 

Did you try installing express typings? this is exactly what VSCode does for providing intellisense for this package.

express methods are generated dynamically in runtime, so they can't be resolved during static code analysis. Installing TypeScript stubs should help to get methods like get(), put() etc work: put cursor on 'express' in const express = require('express'); , hit Alt+Enter and choose Install TypeScript definitions for better type information to install typings - see https://www.jetbrains.com/help/webstorm/configuring-javascript-libraries.html#ws_jsconfigure_libraries_ts_definition_files

1

Elena Pogorelova I just get same answer for it on SO so yes it works like a charm now.. I didn't know that we have to do it manually and wasn't able to find an answer for it anywhere so I know that now.. Hopefully this will help others so they don't have to spend whole day to fix it like me then. Thank you very much anyway.  A little extension to your answer -- If you are on mac use `option+Enter`

0

Please sign in to leave a comment.