π Search Terms
Maximum call stack size exceeded
instantiateTypeWithAlias
Infinite recursion crash
Regression 5.9
π Version & Regression Information
5.7.3: Works (Emits TS2589)
5.8.3: Works (Emits TS2589)
5.9.3: Crashes
Nightly: Crashes
β― Playground Link
https://www.typescriptlang.org/zh/play/?target=7&ts=6.0.0-dev.20260108#code/PTAECUFMAcCcHtQDMEFtQGIDMBGAHAExYCwAUJAB7TywAuotAntJKAAqwyQB2AJgDwBRADaoANKAAqoSrR68AzqACu3ANbd4Ad24BtALoA+UAF4yUmRTl8lqjdu6gA-OYAUrgIawA5gC5QIuKgAHShnAq0-pIAlKbGAG7wAJa8sbLySu6hwV7eCv5J3EiQsFIEsSYJyanOZaD+5tyQ8SX1jc0lANxklNR0DMysghQeAMa0w7SwY7T8khIAqsYmoK7S6TagC7XbG4oWThb+TS2lxx2wsQBkoBGwhd7dpEwsoADC8Nzxc4umUsugcwAb1AAAZ-LpJPpOqAcP4OFw+D93p9vsMZpNpuN+AsJJJDATOgBfXS7KwZA5g+qw6FAA
π» 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) & boolean;
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>>>;}[U extends T ? 0 : 1];
π Actual behavior
.\ts-versions\nightly\node_modules\.bin\tsc.cmd C:\Users\aw\Desktop\itr-new\result0\mutated\infiniteConstraints_mutated_iter9.ts
D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:123181
throw e;
^
RangeError: Maximum call stack size exceeded
at instantiateType (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:63527:27)
at instantiateList (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:63154:24)
at instantiateTypes (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:63168:12)
at instantiateTypeWorker (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:63592:24)
at instantiateTypeWithAlias (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:63560:20)
at instantiateType (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:63528:29)
at getMappedType (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:63208:67)
at D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:63513:66
at map (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:196:19)
at getConditionalTypeInstantiation (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:63513:29)
Node.js v22.19.0
If I change the intersection type in ExactExtract from & string to & boolean, the compiler's behavior changes from a crash to a hang.
π Expected behavior
The compiler should not crash.
Additional information about the issue
No response
π Search Terms
Maximum call stack size exceeded
instantiateTypeWithAlias
Infinite recursion crash
Regression 5.9
π Version & Regression Information
5.7.3: Works (Emits TS2589)
5.8.3: Works (Emits TS2589)
5.9.3: Crashes
Nightly: Crashes
β― Playground Link
https://www.typescriptlang.org/zh/play/?target=7&ts=6.0.0-dev.20260108#code/PTAECUFMAcCcHtQDMEFtQGIDMBGAHAExYCwAUJAB7TywAuotAntJKAAqwyQB2AJgDwBRADaoANKAAqoSrR68AzqACu3ANbd4Ad24BtALoA+UAF4yUmRTl8lqjdu6gA-OYAUrgIawA5gC5QIuKgAHShnAq0-pIAlKbGAG7wAJa8sbLySu6hwV7eCv5J3EiQsFIEsSYJyanOZaD+5tyQ8SX1jc0lANxklNR0DMysghQeAMa0w7SwY7T8khIAqsYmoK7S6TagC7XbG4oWThb+TS2lxx2wsQBkoBGwhd7dpEwsoADC8Nzxc4umUsugcwAb1AAAZ-LpJPpOqAcP4OFw+D93p9vsMZpNpuN+AsJJJDATOgBfXS7KwZA5g+qw6FAA
π» Code
π Actual behavior
If I change the intersection type in ExactExtract from & string to & boolean, the compiler's behavior changes from a crash to a hang.
π Expected behavior
The compiler should not crash.
Additional information about the issue
No response