microsoft / microsoft/TypeScript
Vanilla JS: Mixins break inherited type hints
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.4k
- Ø Merge
- 1 T. 19 Std.
- Gemergte PRs (30 T.)
- 117
Beschreibung
Does this issue occur when all extensions are disabled?: Yes
- VS Code Version: 1.84.2
- OS Version: Windows 10
The issue is quite simple, as shown below, mixins break inherited type hints. exampleMethod() below should have hint references for this.myStr and this.propIsHinted but does not.
Apologies if this belongs somewhere else like the typescript repo, it's vanilla JS but it's probably related to typescript/JSDoc functionality.
function NumberMixin( Base ) {
return class NumberMixin extends Base {
/** @type {number} */
myNum;
};
}
function StringMixin( Base ) {
return class StringMixin extends Base {
/** @type {string} */
myStr;
};
}
class MyBase {
/** @type {boolean} */
propIsHinted;
}
class SuperClass extends NumberMixin(StringMixin(MyBase)) {
exampleMethod() {
// Hinted
this.myNum;
// Not hinted
this.myStr;
// Not hinted
this.propIsHinted;
}
}
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
Führe das bereitgestellte JavaScript-Mixin-Beispiel im TypeScript- oder VS Code-Kontext aus, um die fehlenden Hinweise zu reproduzieren. Beginne damit, die JSDoc-Typinferenz für geerbte Klassen und verschachtelte Mixins nachzuverfolgen; abgeschlossen ist es, wenn exampleMethod() Hinweise für myNum, myStr und propIsHinted bereitstellt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, typescript
- Bereich
- compilers
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 38/100