🔎 Search Terms
RangeError: Maximum call stack size exceeded
instantiateTypeWorker recursion
instantiateTypeWithAlias crash
Domain: check: Type Circularity
🕗 Version & Regression Information
5.7.3 / 5.8.3 / 5.9.3 / Nightly: Crashes with RangeError.
TS 7.0 : TIMEOUT
⏯ Playground Link
https://www.typescriptlang.org/zh/play/?target=7&ts=6.0.0-dev.20260318#code/PTAECUFMAcCcHtQDMEFtQGIDMBGAHAExYBQkAHtPLAC6jUCe0koACrDJAHYAmAPAKIAbVABpQAFVDlqXbgGdQAV04BrTvADunANoBdAHygAvMQlSyMnguVrNnUAH5TACmcBDWAHMAXKCGjQADpg9jlqX3EASmNDADd4AEtuaOlZBVdgwI9POV8EziRIWAkCaKM4xOTHEtBfU05IWKLa+saigG5iEHJKGjpGZn4yNwBjaiHqWFHqXnExAFVDI1BnSVSrUHnqrfX5MwczXwam4qO22GiAMlAAI3h4QUg3Tk6eqloGJj9hsYmpsdmCyWKzWFjSm225kse0kB0kZxOtVAxyKV1AYVg+U8nU+zAAwvBOLFARDluJgQBvUygGkABl82nEuk6NJpOF8bA4PBJBKJAh+4ws-xm8zE5LEFLcvjk9FQd0EAF99PpOgrtDswRtYaBaUicMziMQgA
💻 Code
// Repro from #31823
export type Prepend<Elm, T extends unknown[]> =
T extends unknown ?
((arg: Elm, ...rest: T) => void) extends ((...args: infer T2) => void) ? T2 :
never :
never;
export type ExactExtract<T, U> = (T extends U ? U extends T ? T : never : never) & string;
type Conv<T, U = T> = {
0: [T];
1: Prepend<T, Conv<ExactExtract<U, T>, {a: number}>>;
}[U extends T ? 0 : 1];
🙁 Actual behavior
node built/local/tsc.js -noEmit infiniteConstraints_mutated_batch12.ts
D:\github\TypeScript\built\local\_tsc.js:123721
throw e;
^
RangeError: Maximum call stack size exceeded
at instantiateType (D:\github\TypeScript\built\local\_tsc.js:63702:27)
at instantiateList (D:\github\TypeScript\built\local\_tsc.js:63329:24)
at instantiateTypes (D:\github\TypeScript\built\local\_tsc.js:63343:12)
at instantiateTypeWorker (D:\github\TypeScript\built\local\_tsc.js:63768:24)
at instantiateTypeWithAlias (D:\github\TypeScript\built\local\_tsc.js:63736:20)
at instantiateType (D:\github\TypeScript\built\local\_tsc.js:63703:29)
at instantiateList (D:\github\TypeScript\built\local\_tsc.js:63329:24)
at instantiateTypes (D:\github\TypeScript\built\local\_tsc.js:63343:12)
at instantiateTypeWorker (D:\github\TypeScript\built\local\_tsc.js:63787:72)
at instantiateTypeWithAlias (D:\github\TypeScript\built\local\_tsc.js:63736:20)
Node.js v22.19.0
🙂 Expected behavior
The fix implemented in #63136 is being bypassed by this specific construction. While the PR intended to yield an errorType when hitting the depth limit, this case triggers a RangeError before the compiler can recover or emit TS2589.
Additional information about the issue
No response
🔎 Search Terms
RangeError: Maximum call stack size exceeded
instantiateTypeWorker recursion
instantiateTypeWithAlias crash
Domain: check: Type Circularity
🕗 Version & Regression Information
5.7.3 / 5.8.3 / 5.9.3 / Nightly: Crashes with RangeError.
TS 7.0 : TIMEOUT
⏯ Playground Link
https://www.typescriptlang.org/zh/play/?target=7&ts=6.0.0-dev.20260318#code/PTAECUFMAcCcHtQDMEFtQGIDMBGAHAExYBQkAHtPLAC6jUCe0koACrDJAHYAmAPAKIAbVABpQAFVDlqXbgGdQAV04BrTvADunANoBdAHygAvMQlSyMnguVrNnUAH5TACmcBDWAHMAXKCGjQADpg9jlqX3EASmNDADd4AEtuaOlZBVdgwI9POV8EziRIWAkCaKM4xOTHEtBfU05IWKLa+saigG5iEHJKGjpGZn4yNwBjaiHqWFHqXnExAFVDI1BnSVSrUHnqrfX5MwczXwam4qO22GiAMlAAI3h4QUg3Tk6eqloGJj9hsYmpsdmCyWKzWFjSm225kse0kB0kZxOtVAxyKV1AYVg+U8nU+zAAwvBOLFARDluJgQBvUygGkABl82nEuk6NJpOF8bA4PBJBKJAh+4ws-xm8zE5LEFLcvjk9FQd0EAF99PpOgrtDswRtYaBaUicMziMQgA
💻 Code
🙁 Actual behavior
🙂 Expected behavior
The fix implemented in #63136 is being bypassed by this specific construction. While the PR intended to yield an errorType when hitting the depth limit, this case triggers a RangeError before the compiler can recover or emit TS2589.
Additional information about the issue
No response