microsoft / microsoft/TypeScript
Support @class in JSDoc
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
From https://github.com/Microsoft/vscode/issues/15168
For the following JavaScript code:
/**
* @class
*
* @param {number} x
*/
function Foo(x) {
this.x = x
}
/**
* @param {Foo} foo
*/
const request = function(foo) {
}
The @class jsdoc annotation for Foo does not seem to be recognized, so the type of foo in request is any:

Changing the code to use class fixes the issue (you don't actually need the @class in this case):

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 with the JavaScript and JSDoc example in the issue, then trace TypeScript's JSDoc handling and type inference for the @class annotation. Done means the Foo constructor is recognized as a type so the foo parameter is no longer any, with a regression test covering the example.
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