microsoft / microsoft/TypeScript

JSDoc type reference doesn't skip leading asterisk

Open
#32,280 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Domain: JSDoc
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

TypeScript Version: typescript@3.6.0-dev.20190704

Search Terms:
checkjs
jsdoc
multi-line
multiline
Code

/**
 * @returns {
 *   | 'a'
 *   | 'b'
 *   | 'c'
 * } - this type is parsed as `any`.
 */
function f() {
  return true;
}

Expected behavior:
Error on incompatible return type.
Actual behavior:
No error. The jsdoc return type is parsed as any.
Playground Link:
Not available.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the multiline JSDoc @returns example in the report and inspect the TypeScript JSDoc type parsing path. Verify that leading asterisks are skipped and that the incompatible boolean return produces an error instead of treating the type as any.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.