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

For checkJS, error when JSDoc @see tag text starts with [ #44958

Closed
jaydenseric opened this issue Jul 9, 2021 · 3 comments · Fixed by #46348
Closed

For checkJS, error when JSDoc @see tag text starts with [ #44958

jaydenseric opened this issue Jul 9, 2021 · 3 comments · Fixed by #46348
Assignees
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue

Comments

@jaydenseric
Copy link

Bug Report

In a JS file with TS checking enabled, JSDoc @see tag text content that begins with [ (e.g. when the text content is a markdown link) incorrectly results in a TS error Identifier expected. at the [.

🔎 Search Terms

jsdoc @see tag Identifier expected

🕗 Version & Regression Information

Error seen in v4.1.5 and v4.3.5; probably the bug exists in every version so far that parses JSDoc @see tags.

⏯ Playground Link

// @checkJs
// @filename: a.js

/**
 * @see [TypeScript docs](https://www.typescriptlang.org/docs).
 */

Workbench Repro

💻 Code

In a.js:

// @ts-check

/**
 * @see [TypeScript docs](https://www.typescriptlang.org/docs).
 */

🙁 Actual behavior

TS error Identifier expected. at the opening [ of the JSDoc @see tag markdown text.

🙂 Expected behavior

No TS error.

@jaydenseric
Copy link
Author

jaydenseric commented Jul 9, 2021

What's funny is that even with the TS errors, VS Code can still render such @see tag markdown correctly in tooltips (although the syntax highlighting of the source is bugged):

Screen Shot 2021-07-09 at 6 11 35 pm

@Kingwl
Copy link
Contributor

Kingwl commented Jul 9, 2021

I guess it's should fallback to raw comments here? /cc: @sandersn

What's funny is that

Markdown render is provided by vscode. And the diagnostic is provided by TypeScript.

@sandersn sandersn changed the title TS error when JSDoc @see tag text starts with [ For checkJS, error when JSDoc @see tag text starts with [ Jul 9, 2021
@sandersn sandersn added the Bug A bug in TypeScript label Jul 9, 2021
@sandersn sandersn self-assigned this Jul 9, 2021
@sandersn sandersn added this to the TypeScript 4.5.0 milestone Jul 9, 2021
@sandersn
Copy link
Member

sandersn commented Jul 9, 2021

Note that checkJS is the only mode that shows jsdoc parse errors because in that mode we assume you want to write correct tags -- that is, one that the compiler understands. However, markdown links should count as 'correct' for @see, even though the compiler doesn't understand them.

@sandersn sandersn added this to Not started in Rolling Work Tracking Oct 11, 2021
@typescript-bot typescript-bot added the Fix Available A PR has been opened for this issue label Oct 13, 2021
Rolling Work Tracking automation moved this from Not started to Done Oct 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue
Projects
Development

Successfully merging a pull request may close this issue.

4 participants