microsoft / microsoft/TypeScript
Support abstract mixin classes.
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.3k
- Ø Merge
- 1 T. 19 Std.
- Gemergte PRs (30 T.)
- 117
Beschreibung
Search Terms
Related, but not completely the same: https://github.com/microsoft/TypeScript/issues/29653
Suggestion
Allow mixin classes to be abstract.
Use Cases
For example, by using a mixin, it might require the user to implement a method.
Examples
type Constructor<T = any, A extends any[] = any[]> = new (...a: A) => T
function AwesomeMixin<T extends Constructor>(Base: T = Object) {
return abstract class Awesome extends Base {
abstract someMethod(): number
}
}
gives:
Cannot find name 'abstract'.
and
Unreachable code detected
Checklist
My suggestion meets these guidelines:
- 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, etc.)
- This feature would agree with the rest of TypeScript's Design Goals.
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 Beispiel für ein abstraktes Mixin und dem damit verknüpften Playground und vergleiche anschließend das zugehörige Issue #29653. Bestätige, wie der Compiler abstract derzeit in zurückgegebenen Mixin-Klassen parst und prüft; abgeschlossen ist die Aufgabe, wenn das Beispiel ohne die gemeldeten Fehler typgeprüft wird, während das erzeugte JavaScript unverändert bleibt.
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
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100