Using the Salsa work with @param tags works fine for function declarations, but not for assignments of function expressions. This is particularly a problem in the CommonJS case. For example with the module below, sub correctly shows the params as of type number, whereas add shows them as type any.
/**
* @param {number} a The number to subtract from
* @param {number} b The number to subtract
*/
function sub(a, b) {
return a - b;
}
exports.sub = sub;
/**
* @param {number} a - First term
* @param {number} b - Second term
*/
exports.add = function(a, b) {
return a + b;
}
The JsDoc tags should apply to the resulting value of the expression.
Using the Salsa work with
@paramtags works fine for function declarations, but not for assignments of function expressions. This is particularly a problem in the CommonJS case. For example with the module below,subcorrectly shows the params as of typenumber, whereasaddshows them as typeany.The JsDoc tags should apply to the resulting value of the expression.