microsoft / microsoft/TypeScript
TS2589 regression in 6.0: implements without type parameters causes excessive type instantiation when property uses concrete generic type
Nessuno ha ancora preso questa issue.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.3k
- Merge medio
- 2g 4h
- PR unite (30g)
- 132
Descrizione
🔎 Search Terms
Type instantiation is excessively deep and possibly infinite.
🕗 Version & Regression Information
- This changed between versions 5.9.3 and 6.0.2
⏯ Playground Link
💻 Code
import type { RouterLocation, WebComponentInterface } from "@vaadin/router";
type RouteExt = { section?: string };
// TS2589 on the class declaration below.
// Fix: replace `WebComponentInterface` with `WebComponentInterface<RouteExt>`.
//
// Note: the error only triggers because `location` is typed with a concrete type
// parameter (`RouterLocation<RouteExt>`). Using `RouterLocation` without a type
// parameter does not trigger it.
export class MyElement extends HTMLElement implements WebComponentInterface {
location?: RouterLocation<RouteExt>;
}
🙁 Actual behavior
I get this error:
Type instantiation is excessively deep and possibly infinite.
But the information isn't very useful to know what to do exactly in this case.
🙂 Expected behavior
Ideally no error, otherwise some more pointers about how to fix this.
Additional information about the issue
When running with --extendedDiagnostics:
typescript 5.9.3:
Files: 259
Types: 203241
Instantiations: 2593860
typescript 6.0.2:
Files: 259
Types: 217322
Instantiations: 5379836
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
Start with the linked Playground and compare TypeScript 5.9.3 with 6.0.2 using --extendedDiagnostics, focusing on the implements declaration and concrete RouterLocation property. Trace the type-instantiation path responsible for TS2589 and validate the result against the provided reproduction; done means the example no longer reports the error or provides more actionable guidance.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- typescript
- Ambito
- compilers
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Tranquilla
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100