-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue
Description
🔎 Search Terms
RangeError: Maximum call stack size exceeded
containsReference stack overflow
ImportType malformed generic crash
Circularity check crash nested conditional
🕗 Version & Regression Information
Versions tested: 5.7.3, 5.8.3, 5.9.3, Nightly
Behavior: All tested versions crash.
Key Trigger: A generic type from an import() call is used inside a nested conditional type, but the generic arguments are missing or syntactically invalid (e.g., import("./name").Name instead of import("./name").Name).
⏯ Playground Link
💻 Code
// #31824
// @filename: name.ts
export type Name<T> = any;
// @filename: index.ts
type T<X> = any extends ((any extends any ? any : string) extends any ? import("./name").Name: any)
? any
: any;🙁 Actual behavior
.\ts-versions\nightly\node_modules\.bin\tsc.cmd C:\Users\aw\Desktop\corpus\nestedGenericConditionalTypeWithGenericImportType.ts
D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:123181
throw e;
^
RangeError: Maximum call stack size exceeded
at forEachChild (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:28725:22)
at containsReference (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:63412:16)
at visitNode2 (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:28209:18)
at forEachChildInLiteralType (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:28355:12)
at forEachChild (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:28730:35)
at containsReference (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:63412:16)
at visitNode2 (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:28209:18)
at forEachChildInImportType (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:28341:12)
at forEachChild (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:28730:35)
at containsReference (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:63412:16)
Node.js v22.19.0
🙂 Expected behavior
The compiler should not crash.
Additional information about the issue
No response
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue