microsoft / microsoft/TypeScript
Support JSDoc `@property`
Nessuno ha ancora preso questa issue.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.3k
- Merge medio
- 2g 4h
- PR unite (30g)
- 132
Descrizione
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
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
La issue fornisce MyController.js come riproduzione, utilizzando una classe JavaScript con un binding di componente Angular e un errore this.world. Inizia riproducendo quell'esempio e tracciando il supporto JSDoc esistente; il lavoro è completato quando una dichiarazione @property appropriata può descrivere il binding senza @ts-ignore.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript, typescript
- Ambito
- compilers
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100