I'm trying to document an Express middleware, but the build-in validation tool in WebStorm tells me that types are incorrectly assigned in the following JSDoc block:
/**
* My middleware.
*
* @param {Object} req
* @param {Object} res
* @param {Function} next
* @return {Object}
*/
exports.show = function(req, res, next) {
...
};
In Express sources, I didn't find any @typedef
s to help me. Also, I want to avoid things like @param {*}
.
What is the correct way to document Express middleware using JSDoc? Thanks for any help.
npm install --save-dev @types/express
@param {e.Response} res
/node_modules/@types/express/index.d.ts
...
declare namespace e {
...
export interface Response extends core.Response { }
...
install types via Settings > Languages & Frameworks > Javascript > Libraries > @types/express