π 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
https://www.typescriptlang.org/play/?target=7#code/JYWwDg9gTgLgBDAnmApnA3nAShArjFKAGQgGMBDGYCAOwBo4B1FAIwGEJxaUaYBJXoQBm5UmgC+cIVE5wARAAEAbuXIATYDQD0M-ITkBuAFBGkqbHgIBRAB7wAvBjgBnFKSq0A-AC4XMKJoA5nDixkZaWnAAKgDKAEwArAAcAJxwtAgAFmikADbkzs5wam75UJTUNHAsKLkQAO4AdOGRAGLANr5QKGD5YnAABszsnJA0PPyCUCJiA3D1wDCZg8McXOO8AgTToigAPDh6tjAAfAPNES1wAHIQBL5LaIQyUOk0uYgIAYGBhEU1FFwrkGdQoHhoc2ARTMKDU80Wy3IcFItFI3QICGQKCuYHI5RAKG2cAAFANDtsSGDKgdLChjmcAJSNOAAVWcQUG5MIlIqtDmCyWljgSJhOLx5AJRLUEBQRRody+wB+hDgi2aKBskFgyPyhTgAFlEFZcigCbw4BqCDQ1EUABJRfVEY2miaq8Ams0wIqrUbcTZTGZodBGOBwUG8mg+Cx6YhkCM0o52E7GcRGIA
π» 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
π Search Terms
Type instantiation is excessively deep and possibly infinite.
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play/?target=7#code/JYWwDg9gTgLgBDAnmApnA3nAShArjFKAGQgGMBDGYCAOwBo4B1FAIwGEJxaUaYBJXoQBm5UmgC+cIVE5wARAAEAbuXIATYDQD0M-ITkBuAFBGkqbHgIBRAB7wAvBjgBnFKSq0A-AC4XMKJoA5nDixkZaWnAAKgDKAEwArAAcAJxwtAgAFmikADbkzs5wam75UJTUNHAsKLkQAO4AdOGRAGLANr5QKGD5YnAABszsnJA0PPyCUCJiA3D1wDCZg8McXOO8AgTToigAPDh6tjAAfAPNES1wAHIQBL5LaIQyUOk0uYgIAYGBhEU1FFwrkGdQoHhoc2ARTMKDU80Wy3IcFItFI3QICGQKCuYHI5RAKG2cAAFANDtsSGDKgdLChjmcAJSNOAAVWcQUG5MIlIqtDmCyWljgSJhOLx5AJRLUEBQRRody+wB+hDgi2aKBskFgyPyhTgAFlEFZcigCbw4BqCDQ1EUABJRfVEY2miaq8Ams0wIqrUbcTZTGZodBGOBwUG8mg+Cx6YhkCM0o52E7GcRGIA
π» Code
π Actual behavior
I get this error:
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:
typescript 6.0.2: