microsoft / microsoft/TypeScript
Leading JSDoc `*` in type expression incorrectly parsed
Open
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
I tried the following snippet
/**
* @typedef {
* import('../src/index.js').FakeCloudwatchLogs
* } FakeCloudwatchLogs
*/
This did not compile with
test/index.js:11:6 - error TS1005: '}' expected.
11 * import('../src/index.js').FakeCloudwatchLogs
~~~~~~
Removing the * and writing
/**
* @typedef {
import('../src/index.js').FakeCloudwatchLogs
* } FakeCloudwatchLogs
*/
Does compile.
I am using typsecript 3.8.3
There is a related issue
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue from test/index.js using the reported TypeScript 3.8.3 snippet and compare it with the version that omits the leading *. Trace the JSDoc typedef parsing entry point to determine why the comment prefix is treated as part of the type expression; done means both forms compile without the TS1005 error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100