microsoft / microsoft/TypeScript
Treat `T[keyof T]` as covariant (rather than invariant) during variance measurement
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
Suggestion
See title. Will fill in more details later.
🔍 Search Terms
List of keywords you searched for before creating this issue. Write them down here so that others can find this suggestion more easily and help provide feedback.
✅ Viability 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, new syntax sugar for JS, etc.)
- This feature would agree with the rest of TypeScript's Design Goals.
⭐ Suggestion
A lot of mapped types are covariant by construction, but we're not always able to determine that
📃 Motivating Example
💻 Use Cases
See incoming linked issues
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
Der Issue schlägt vor, T[keyof T] während der Varianzmessung als kovariant zu behandeln, und weist darauf hin, dass mapped types nicht immer als kovariant erkannt werden. Da keine Quelldateien, Tests oder Compiler-Einstiegspunkte angegeben sind, beginne damit, die Varianzmessung und die Behandlung von mapped types im TypeScript compiler zu finden. Als erledigt gilt die Aufgabe, wenn das beabsichtigte Kovarianzverhalten spezifiziert und durch geeignete Typprüfungs-Tests abgedeckt ist.
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
- Muss geklärt werden
- Anfängerfreundlichkeit
- 20/100