Repository navigation
Crash: when inferring from a tuple with middle rest elements and trailing variadic elements #63005
Copy link
Copy link
Open
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: CrashesUnhandled exceptions/panics with no immediate primary root cause identifiedUnhandled exceptions/panics with no immediate primary root cause identifiedHelp WantedYou can do thisYou can do this
Milestone
Description
🔎 Search Terms
Internal Error: Debug Failure
Variadic tuple types crash
infer rest elements crash
tuple mapping crash
🕗 Version & Regression Information
Versions tested: 5.7.3, 5.8.3, 5.9.3, Nightly
⏯ Playground Link
💻 Code
// repro #51138
type SubTup2RestAndTrailingVariadic2<T extends unknown[]> = T extends [
...(infer C)[],
...infer B extends [any,any,crash]
]
? [C,...B]
: never;
type SubTup2RestAndTrailingVariadic2Test = SubTup2RestAndTrailingVariadic2<[...a: 0[],b: 1,c: 2]>;🙁 Actual behavior
.\ts-versions\nightly\node_modules\.bin\tsc.cmd .\inferTypesWithFixedTupleExtendsAtVariadicPosition_m.ts
D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:123178
throw e;
^
TypeError: Cannot read properties of undefined (reading 'aliasSymbol')
at inferFromTypes (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:68512:18)
at inferFromObjectTypes (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:68994:21)
at invokeOnce (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:68704:9)
at inferFromTypes (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:68666:11)
at inferTypes (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:68500:5)
at getConditionalType (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:62537:11)
at getConditionalTypeInstantiation (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:63526:305)
at instantiateTypeWorker (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:63629:14)
at instantiateTypeWithAlias (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:63566:20)
at getTypeAliasInstantiation (D:\do\typeFuzz\ts-versions\nightly\node_modules\typescript\lib\_tsc.js:60132:52)
Node.js v22.19.0
🙂 Expected behavior
The compiler should report a syntax error and not crash.
Additional information about the issue
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: CrashesUnhandled exceptions/panics with no immediate primary root cause identifiedUnhandled exceptions/panics with no immediate primary root cause identifiedHelp WantedYou can do thisYou can do this
Activity
[-]Compiler Crash when inferring from a tuple with middle rest elements and trailing variadic elements[/-][+]Crash: when inferring from a tuple with middle rest elements and trailing variadic elements[/+]RyanCavanaugh commentedon Jan 20, 2026
🤖 Thank you for your issue! I've done some analysis to help get you started. This response is automatically generated; feel free to 👍 or 👎 this comment according to its usefulness.
Similar Issues
Here are the most similar issues I found
If your issue is a duplicate of one of these, feel free to close this issue. Otherwise, no action is needed.
Possibly Working as Intended
It looks like this behavior might be intentional. Here's what a computer had to say about it.
The pattern
...(infer C)[]is not legal tuple‐pattern syntax. A rest element may be written as...infer C(optionally with a constraint such as...infer C extends unknown[]), but it cannot be followed by[]. The compiler should therefore issue a normal syntax or type error. Instead it dereferences an internal object and crashes, which is an internal compiler error. So the observed behavior is a compiler bug, not the correct or expected diagnostics.Fix crash when inferring from tuple with middle rest and trailing var…