microsoft / microsoft/TypeScript
JSDoc param tag's default value parsing should support non-TS expressions
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.4k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 117
Description
Suggestion
probably related to #44930 but a different use case. default values on @param: https://jsdoc.app/tags-param.html
🔍 Search Terms
jsdoc param default value
⭐ Suggestion
Please allow for default value params parsing
/**
* @param {string} [somebody=John Doe] - Somebody's name.
*/
export function sayHello(somebody) {
}
currently parses to tags:
[
{
name: "param",
text: [
{
text: "somebody",
kind: "parameterName"
},
{
text: " ",
kind: "space"
},
{
text: "Doe] - Somebody's name.",
kind: "text"
}
]
}
]
possibly add a new node
{
text: "John Doe",
kind: "defaultValue"
},
and clean up the description from
{
text: "Doe] - Somebody's name.",
kind: "text"
}
to
{
text: "- Somebody's name.",
kind: "text"
}
p.s. it mighy also be worth in general to clean up parameter descriptions text from the leading hyphen
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 at the JSDoc @param parsing entry point and compare the reported AST for [somebody=John Doe] with the requested defaultValue node. Done means non-TS default expressions are preserved as default values, the description no longer includes the closing bracket or parameter-name text, and coverage verifies the example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100