microsoft / microsoft/TypeScript
Quick fix proposal: declare property for jsdoc types
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/44824
Search Terms
- quick fix / code action
- jsdoc / jsdocs
Suggestion
Introduce a new refactoring that introduces a property into a jsdoc type. For example, for the js:
//@ts-check
/**
* @param {{ }} arg
*/
function doStuff(arg) {
console.log(arg.noSuch);
}
A quick fix on noSuch would add this property to the type of arg:
//@ts-check
/**
* @param {{noSuch: object }} arg
*/
function doStuff(arg) {
console.log(arg.noSuch);
}
A similar refactoring already exists for typescript:
interface IFoo {
a: number
}
function doStuff(arg: IFoo) {
console.log(arg.noSuch);
}

Use Cases
Improve experience using ts-check, especially if using complex types
Other cases to consider
typedef
//@ts-check
/**
* @typedef {{ a: number}} IFoo
*/
/**
*
* @param {IFoo} arg
*/
function doStuff(arg) {
console.log(arg.noSuch);
}
Augments
/**
* @augments {Component<{}>}
*/
class Binek extends Component {
render() {
console.log(this.props.noSuch)
}
}
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 existing TypeScript refactoring for adding an interface property and the linked VS Code issue, then compare its behavior with the JSDoc parameter, typedef, and augments examples here. Done means a quick fix can add the missing property to the relevant JSDoc type while covering the listed cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100