microsoft / microsoft/TypeScript
Creating too many types for DOM & D3
Nessuno ha ancora preso questa issue.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.3k
- Merge medio
- 2g 4h
- PR unite (30g)
- 132
Descrizione
Commit 06fe1ed53721862b56c61ebb89b1daee2bc10710 introduced a regression in the number of types created when compiling a snippet of @types\d3. Specifically, it appears to be elaborating types for an error message that ends up getting dropped.
Repro:
{
"compileOnSave": false,
"compilerOptions": {
"alwaysStrict": true,
"noImplicitAny": true,
"noEmit": true,
"lib": [ "es5", "dom" ],
"noResolve": true,
"types": [],
"skipLibCheck": true
},
"files": [
"test.ts",
}
test.ts
declare function select<GElement extends BaseType, OldDatum>(selector: string): Selection2<GElement, OldDatum, HTMLElement, any>;
type BaseType = Element | Document | Window | null | number;
type ValueFn<T extends BaseType, Datum, Result> = (this: T, datum: Datum, index: number, groups: T[] | ArrayLike<T>) => Result;
interface Selection2<GElement extends BaseType, Datum, PElement extends BaseType, PDatum> {
select<DescElement extends BaseType>(selector: ValueFn<GElement, Datum, DescElement>): Selection2<DescElement, Datum, PElement, PDatum>;
}
For an apples-to-apples comparison, use nolib and specify the 3.1 lib.es5.d.ts and lib.dom.d.ts for both compilations.
In round numbers, there are ~150 types without the change and ~2500 types with the change.
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
Riproduci il problema con le compilerOptions fornite e lo snippet test.ts, confrontando i conteggi dei tipi di circa 150 e 2500 usando i file lib.es5.d.ts e lib.dom.d.ts della versione 3.1. Ispeziona il commit 06fe1ed53721862b56c61ebb89b1daee2bc10710 e il percorso di elaborazione dei messaggi di errore del compilatore. Il lavoro è completato quando la compilazione della riproduzione non elabora più i tipi dei messaggi di errore scartati.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- d3, typescript
- Ambito
- compilers, performance
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 32/100