microsoft / microsoft/TypeScript

Explicit variance annotations for built-in .d.ts files

Aperta
#62,954 1 commento 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Experimentation Needed In Discussion Suggestion
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

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. 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

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.