microsoft / microsoft/TypeScript
Idea: Can declaration emit synthesize type aliases?
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
Object types can be very large and in (e.g.) a react project that makes heavy use of type inference, it's not uncommon to have to refer to a type that is either not imported or is simply anonymous (e.g. a props type). When these appear in multiple places in a declaration file, they tend to expand it considerably. Perhaps we could just synthesize type aliases for them?
- We'd have to be careful not to change the exported API shape
- We could use a heuristic to skip the work for small types (e.g. < 20 characters)
- Even if we didn't wait until the second use of a type to decide to extract it, we'd be adding ~4 tokens per type (
type id =andidat the use site)
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 schlägt vor, bei der Ausgabe von Deklarationen Typ-Aliase für wiederholt auftretende große anonyme Objekttypen zu synthetisieren. Es werden keine Dateien, Tests oder Einstiegspunkte genannt; bilde zunächst die Implementierung der Deklarationsausgabe ab und bewerte die angegebene Größenheuristik. Als abgeschlossen gilt die Reduzierung der Expansion in Deklarationsdateien, ohne die Form der exportierten API zu verändern.
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
- 30/100