Reputation: 4604
Let's say i am starting a new web app with express
, and have vscode as my IDE for this nodejs project
Following code is working well with IntelliSense:
Once the handler is extracted, IntelliSense is gone:
I've tried jsdoc:
/**
*
* @param {express.Request} req
* @param {express.Response} res
*/
function test(req, res) {
req. // no luck
}
Is there any way to have IntelliSense supported in this case?
Upvotes: 1
Views: 593
Reputation: 65223
As of VS Code 1.20, this is a limitation when using require
with JSDoc types (see this issue]
Workaround is to use import
:
import * as express from 'express'
/**
*
* @param {express.Request} req
* @param {express.Response} res
*/
function test(req, res) {
req.
}
https://github.com/Microsoft/TypeScript/issues/14377 also tracks allowing you to specify module imports in jsdocs directly.
Upvotes: 1