Skip to content

Use @param tags in function assignment #6552

Closed
@billti

Description

@billti

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.

Metadata

Metadata

Assignees

Labels

FixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions