microsoft / microsoft/TypeScript
Support JSDoc `@property`
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 @BrunnerLivio on May 8, 2017 9:1
- VSCode Version: 1.12.1
- OS Version: Ubuntu 16.04.1 LTS (Xenial Xerus)
Example code:
MyController.js
// @ts-check
class MyController {
getWorld() {
return this.world; // <--- Marked as error
}
}
angular
.module('myApp')
.component('myComponent', {
bindings: {
'world': '<'
},
controller: MyController,
template: `<div>Hello {{$ctrl.getWorld()}}</div>`
});
The this.world is marked as error, as supposed to be. But it is actually pretty annoying, because in angular you need to use quite often those component bindings. I know there's the option // @ts-ignore, but that really pollutes the code and makes it less readable.
An extensions for this would be really useful.
I use this workaround at the moment
// @ts-check
class MyController {
constructor() {
this.world = this.world;
}
getWorld() {
return this.world;
}
}
[...]
I don't like this at all, but better than writing // @ts-ignore.
Is there any other option / workaround?
Copied from original issue: Microsoft/vscode#26192
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
Das Issue stellt MyController.js als Reproduktion bereit und verwendet dabei eine JavaScript-Klasse mit einem Angular-Komponenten-Binding sowie einen this.world-Fehler. Beginne damit, dieses Beispiel zu reproduzieren und die vorhandene JSDoc-Unterstützung nachzuverfolgen; die Arbeit ist abgeschlossen, wenn eine geeignete @property-Deklaration das Binding ohne @ts-ignore beschreiben kann.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, typescript
- Bereich
- compilers
- Issue-Typ
- Feature
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100