microsoft / microsoft/TypeScript
Quick fix proposal: declare property for jsdoc types
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.3k
- Ø Merge
- 2 T. 4 Std.
- Gemergte PRs (30 T.)
- 132
Beschreibung
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)
}
}
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit dem bestehenden TypeScript-Refactoring zum Hinzufügen einer Interface-Eigenschaft und dem verknüpften VS Code-Issue, und vergleiche dann sein Verhalten mit den Beispielen für JSDoc-Parameter, typedef und augments hier. Erledigt ist es, wenn ein Quick Fix die fehlende Eigenschaft zum relevanten JSDoc-Typ hinzufügen kann und dabei die aufgeführten Fälle abdeckt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, typescript
- Bereich
- compilers
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100