microsoft / microsoft/TypeScript
Make standard library types more polyfills‑friendly
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
A significant number of ECMAScript / web standards features that have recently standardized (like Iterator.concat) are still missing from the TypeScript standard library. There are ECMAScript proposals (like Iterator.zip) that are supported by modern browsers but still lack corresponding type definitions. Finally, many projects intentionally target older TypeScript versions with old standard library types.
I am working on types for the core-js polyfill library, which is used on most websites, so it makes a lot of sense to add type definitions for it. While doing this work, I have encountered some significant issues:
-
Some DOM types, for example
URL, are declared as ambient variable declarations with type literals inlib.dom.d.ts. This approach does not allow declaration merging. Possible solution: define them via interfaces (like in ECMAScript types) to allow declaration merging. -
The use of getters/setters. For example,
ArrayBufferdefines the detached property via a getter. This makes it impossible to create a compatible polyfill type for different targets. Similar issues often cause conflicts between different type libraries. In most similar cases, accessors are declared as readonly properties, and this does not cause any problems.
If there were some mechanism for conditional type usage, it could make the standard types more polyfills‑friendly.
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
Beginnen Sie mit der Durchsicht der Ambient-Deklarationen in lib.dom.d.ts und des ArrayBuffer-Accessors in src/lib/es2024.arraybuffer.d.ts sowie des verlinkten core-js- und ECMAScript-Proposal-Kontexts. Als abgeschlossen gilt die Aufgabe, wenn ein abgestimmter Mechanismus vorhanden ist, der Standardbibliothekstypen mit Polyfills und älteren TypeScript-Bibliothekszielen kompatibel macht, zusammen mit den entsprechenden Bibliotheksänderungen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, typescript
- Bereich
- compilers
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 25/100