Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@description JSDoc tag interferes with callback parameter documentation #37346

Open
minestarks opened this issue Mar 11, 2020 · 0 comments
Open
Assignees
Labels
Bug A bug in TypeScript checkJs Relates to checking JavaScript using TypeScript Help Wanted You can do this PursuitFellowship Help wanted from Pursuit fellowship; others please avoid until Dec 19
Milestone

Comments

@minestarks
Copy link
Member

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

@RyanCavanaugh RyanCavanaugh added the Bug A bug in TypeScript label Mar 16, 2020
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Mar 16, 2020
@DanielRosenwasser DanielRosenwasser added Effort: Moderate Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual". Help Wanted You can do this checkJs Relates to checking JavaScript using TypeScript Good First Issue Well scoped, documented and has the green light and removed Effort: Moderate Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual". labels Sep 2, 2020
@sandersn sandersn removed the Good First Issue Well scoped, documented and has the green light label Sep 8, 2020
@sandersn sandersn added the PursuitFellowship Help wanted from Pursuit fellowship; others please avoid until Dec 19 label Sep 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript checkJs Relates to checking JavaScript using TypeScript Help Wanted You can do this PursuitFellowship Help wanted from Pursuit fellowship; others please avoid until Dec 19
Projects
None yet
Development

No branches or pull requests

5 participants