microsoft / microsoft/TypeScript

@description JSDoc tag interferes with callback parameter documentation

Aperta
#37,346 0 commenti 0 reazioni 1 assegnatario Vedi su GitHub

@orta ci sta già lavorando.

Dal 2/9/2020.

Bug checkJs Domain: JSDoc Help Wanted
Lingua principale
Go
Stelle
111k
Fork
14.3k
Merge medio
2g 4h
PR unite (30g)
132

Descrizione

TypeScript Version: 3.8.3

Search Terms: jsdoc param

Expected behavior:
Below code creates no errors, type of x is recognized as (value: number) => boolean

Actual behavior:
Type of x is () => boolean, the invocation creates a type error.

Removing the @description tag makes the code work as expected.

My interpretation of https://jsdoc.app/tags-description.html is that you should be able to place @description anywhere in the comment without interfering with other tags:

By using the @description tag, you can place the description anywhere in the JSDoc comment.

Related Issues: Ran into a crash #37265 while trying to repro this with template parameters.

Code

// @ts-check

/**
 * @callback IterablePredicate
 * @description return true if given element of iterable matches an internal condition
 * @param {number} value the current item being evaluated
 * @returns {boolean} true if the entry satisfies given condition
 **/

/**
 * @type {IterablePredicate}
 */
let x;
x(3) // Expected 0 arguments, but got 1.
Compiler Options
{
  "compilerOptions": {
    "noImplicitAny": true,
    "strictFunctionTypes": true,
    "strictPropertyInitialization": true,
    "strictBindCallApply": true,
    "noImplicitThis": true,
    "noImplicitReturns": true,
    "alwaysStrict": true,
    "esModuleInterop": true,
    "checkJs": true,
    "allowJs": true,
    "declaration": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "moduleResolution": 2,
    "target": "ES2017",
    "jsx": "React",
    "module": "ESNext"
  }
}

Playground Link: Provided

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.