microsoft / microsoft/TypeScript
Show error when JSDoc tags use unknown Symbols
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
Suggestion
Raise error when JSDoc tags reference unknown types
🔍 Search Terms
List of keywords you searched for before creating this issue. Write them down here so that others can find this suggestion more easily and help provide feedback.
is:issue is:open in:title jsdoc error
is:issue is:open in:title jsdoc validate
✅ Viability Checklist
My suggestion meets these guidelines:
- This wouldn't be a breaking change in existing TypeScript/JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
- This feature would agree with the rest of TypeScript's Design Goals.
⭐ Suggestion
Just like unknown symbols are compilation errors, raise also errors when using unknown symbols within JSDoc comments
📃 Motivating Example
class TestWebsite {}
/** @link {TestWebsite-Bogus} */
/** @see {TestWebsite-Bogus} */
/** @type {TestWebsite-Bous} */
There is no error on those references
💻 Use Cases
Typescript already takes type hints from JSDoc comments. Why not close the loop and also type-check JSDoc??
My most frequent code documentation case is referencing symbols and files within comments. However since these are never validated it is normal that with time and some refactorings those references become invalid.
It would be of a great help getting compilation errors on comment references. After all wrong/bad code documentation is worst than no documentation. JSDoc deserves static validation too!
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
Start by reviewing the suggestion and its JSDoc examples, then locate the existing JSDoc type-checking and diagnostic tests; the issue names no files or test entry points. Done means unknown symbols referenced by JSDoc tags such as @link, @see, and @type produce compilation errors without changing emitted JavaScript.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100