Search code examples
node.jswebstorm

WebStorm reports "Unresolved function or method" - how to get rid of this?


I'm working on an application using WebStorm and occasionally I've seen warnings of the "unresolved variable" variety. These I have fixed, thanks to the StackOverflow community, by using JSDoc, either the @param or @namespace labels.

However I have just ONE more "unresolved function or method" to fix. In my app.js file I have the following line:

const app = express().use(bodyParser.json());

WebStorm flags up the .use function as an "unresolved function or method". I've tried resolving this by using JSDoc as follows:

/**
 * @namespace express()
 * @namespace express().use()
 * */

I put this above the const app = express().use(bodyParser.json()); line, but it doesn't make a difference.

Is there another way to get rid of this warning?


Solution

  • the problem is that the express methods list is generated dynamically, and it's not possible to resolve these properties using static code analysis. Running npm i @types/express should solve the problem