microsoft / microsoft/TypeScript
`abstract class` should be usable in expressions
Offen
Dieses Issue hat noch niemand übernommen.
Awaiting More Feedback
Suggestion
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.4k
- Ø Merge
- 1 T. 19 Std.
- Gemergte PRs (30 T.)
- 117
Beschreibung
🔍 Search Terms
abstract, class, expression
✅ Viability Checklist
- This wouldn't be a breaking change in existing TypeScript/JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
- This isn't a request to add a new utility type: https://github.com/microsoft/TypeScript/wiki/No-New-Utility-Types
- This feature would agree with the rest of our Design Goals: https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals
⭐ Suggestion
function myMixin(Base: typeof Object) {
return abstract class Mixed extends Base {};
}
📃 Motivating Example
Preferable to:
function myMixin(Base: typeof Object) {
abstract class Mixed extends Base {}
return Mixed;
}
💻 Use Cases
- What do you want to use this for?
Same uses as without - What shortcomings exist with current approaches?
Slight additional verbosity - What workarounds are you using in the meantime?
Slight additional verbosity
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 vorgeschlagenen mixin-Beispiel und dem motivierenden Vergleich, um die akzeptierte Ausdrucksform und ihr Verhalten bei der Typprüfung zu definieren. Verfolge anschließend die Compiler-Einstiegspunkte für Klassendeklarationen und -ausdrücke und überprüfe dann, dass das Beispiel die Typprüfung besteht und sich an der Laufzeitausgabe nichts ändert.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- typescript
- Bereich
- compilers
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Aktiv
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 35/100