microsoft / microsoft/TypeScript

JSDoc @param does not work for function variables

Aperta
#36,633 2 commenti 2 reazioni 1 assegnatario Vedi su GitHub

@minestarks ci sta già lavorando.

Dal 2/3/2020.

Needs Investigation
Lingua principale
Go
Stelle
111k
Fork
14.3k
Merge medio
1g 19h
PR unite (30g)
117

Descrizione

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:
image

Actual behavior:
image

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.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.