microsoft / microsoft/TypeScript
Explicit variance annotations for built-in .d.ts files
Nessuno ha ancora preso questa issue.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.3k
- Merge medio
- 2g 4h
- PR unite (30g)
- 132
Descrizione
While profiling some projects using typeslayer, I've noticed that according to the type checking traces some time is spent calculating the type variance of common types like `Promise` and others.
I've explicitly annotated some of these generic types, and I've verified that it that sped up typechecking for some of my complex use-cases.
I've verified that these speed-ups also translate to `tsgo` by checking with hyperfine.
I'd like to ask if a PR to add explicit type variance to some of the most commonly used library types could be a valuable addition? I could set up a PR so some performance tests could be run to see if it works in aggregate, I just wanted to ask if it's something that aligns with the projects' goals and to maybe understand if this was tried already
Based on my limited understanding the pros would be:
- More people learning about variance and explicit variance annotations
- Slightly increased performance in some complex scenarios
The cons would be:
- Different error messages as now we'd see `super` and `sub` prefixes that might confuse users
- larger size on the wire/disk
- higher overhead to parse
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Non vengono indicati file sorgente o test. Inizia esaminando i tipi di libreria .d.ts integrati e le tracce del controllo dei tipi descritte nell’issue, quindi confronta le misurazioni di tsgo con hyperfine. Il lavoro è completato quando si raggiunge un accordo sui tipi target comunemente utilizzati e si dimostra l’impatto aggregato sulle prestazioni e sulla diagnostica tramite test delle prestazioni.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- typescript
- Ambito
- compilers, performance
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 25/100