microsoft / microsoft/TypeScript

JSDoc @param does not work for function variables

Abierto
#36,633 2 comentarios 2 reacciones 1 asignado Ver en GitHub

@minestarks ya está trabajando en esto.

Desde el 2/3/2020.

Needs Investigation
Lenguaje dominante
Go
Estrellas
111k
Forks
14.4k
Merge medio
1 d 19 h
PR fusionados (30 d)
117

Descripción

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.

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.