This seems like it should have an obvious answer but I can't find it.
var mongoose = require('mongoose')
/**
* @param {Mongoose.Model} fooModel
*/
function ExecuteAQueryUsingModel(fooModel) {
I am essentially trying to define the parameter to be a Mongoose.Model
, a variable constructed with the mongoose model constructor. I don't know how to set the jsdoc types to be types defined externally like this.
I may be on thin ice here, since I'm just a hobbyist, and I'm only using JSDoc to get IntelliSense in Visual Studio Code. This JSDoc solved my problem:
/** @param {import("express").Response} expressResponse */
function send(expressResponse) {
expressResponse.send('OK');
}
I was not able to find the syntax in http://usejsdoc.org/tags-param.html so this could be specific to typescript. Here's where I found the idea: https://www.typescriptlang.org/docs/handbook/type-checking-javascript-files.html
Hope this gives some help although it may not be completely correct.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.