microsoft / microsoft/TypeScript
JSDoc @param does not work for function variables
Open
@minestarks is already working on this.
Since Mar 2, 2020.
Needs Investigation
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
TypeScript Version: 3.5.1, 3.7.5
Search Terms: jsdoc, param, variable, function
Code
function makeFoo() {
return (x : number) => {}
}
/**
* @param x - Comment
*/
const foo = makeFoo();
foo(/* No comment in hover */);
/**
* @param x - Comment
*/
function foo2(x: number) {
}
foo2(/* Comment in hover */)
Expected behavior:

Actual behavior:

Playground Link: Playground
Related Issues: Couldn't find any
For my use case, I use factories to make functions a lot.
export const lPad = makeOperator3<string, bigint, string, string>(/*args*/);
export const rPad = makeOperator3<string, bigint, string, string>(/*args*/);
export const lTrim = makeOperator1<string, string>(/*args*/);
export const rTrim = makeOperator1<string, string>(/*args*/);
And I'd like to add JSDoc to these variables, because the parameter names aren't very descriptive, by themselves (left, mid, right, arg, etc.). But it seems like the JSDoc for @param does not show up in hover on VS Code and the Playground.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.