You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Recursive tuple cannot be computed through generic, but valid in a declarative form #62704
which is identical to TestB but TS complains the instantiation cannot stop.
🙂 Expected behavior
Stop expansion at first reference at appeared structure Expand<Foo>, that is:
type TestA = Expand<Foo>;
// ^?~ type TestA = ['a', Expand<Foo>]
// or more intelligent `type TestA = ['a', TestA]`
Additional information about the issue
This code is useful when Foo is as const inferred from a runtime constant, and we want a tuple-like typing calculated from Foo. Since TypeScript support self-referential tuple by declarative just like TestB, it would be better for support that in a computed way like Expand<Foo>.
🤖 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.
(71%) microsoft/typescript#39992: Unjustified and undetected circular type definition when using one-tuple to prevent distributive conditional type with a condition
(68%) microsoft/typescript#25291: Stack overflow when spread a tuple type alias inside itself (with conditional type and generic default)
(67%) microsoft/typescript#31619: "Type instantiation is excessively deep and possibly infinite" even for generated non-recursive type
(67%) microsoft/typescript#48401: Source provides no match for required element at position 0 in target despite source extending [any, ...any[]]
(66%) microsoft/typescript#54550: Generic Tuple Optional Parameter spread errors with Type instantiation is excessively deep and possibly infinite. ts(2589)
(66%) microsoft/typescript#40298: Recursive type references with spreading array of self causes circularly error
(66%) microsoft/typescript#40022: recursive deep property access works unless the assigned variable has explicit type annotation?
Activity
RyanCavanaugh commentedon Nov 4, 2025
🤖 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.
RyanCavanaugh commentedon Nov 6, 2025
Not sure what's going wrong here; the stack indicates a runaway instantiating
ExpandMany<Rest>.Alternative form that works the same: