I'm having trouble with intellisense in WebStorm for express package and also for sequelize package. I have also tried VS code and problem there is same. For example with imported package
const express = require('express');
const app = express();
then I get no suggestion for app.get()
or any other method. Even worst I get the get()
method underline in WebStorm with warning saying Unresolved method or function
Code runs fine though. There are also other problems with other packages like sequelize. I kinda managed to fixed express intellisense by adding .application in import which however crash the app
const express = require('express').application;
Another approach I tried was to add enable after initialisation. That doesn't crash the app and intellisense start works even warning is gone
const app = express().enable();
I know this works for others by watching video online. Nobody had to add anything into import or initialisation to make that intellisense work so I guess there is some problem with setting and I just can't figure out what it is
Here are some pictures of my stetting
Adding TypeScript definition files usually helps IDEs to resolve methods that are otherwise hard to resolve based on the static code analysis.
In WebStorm, you can press Alt-Enter on require('express')
and select Install TypeScript definitions for better type information – this will download @types/express
and configure it in the IDE. Alternatively, you can add @types/express
to your package.json file.