microsoft / microsoft/TypeScript

@description JSDoc tag interferes with callback parameter documentation

Ouverte
#37,346 0 commentaires 0 réactions 1 personne assignée Voir sur GitHub

@orta y travaille déjà.

Depuis le 2/9/2020.

Bug checkJs Domain: JSDoc Help Wanted
Langage dominant
Go
Étoiles
111k
Forks
14.3k
Merge moyen
2 j 4 h
PR mergées (30 j)
132

Description

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

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.