-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptCrashFor flagging bugs which are compiler or service crashes or unclean exits, rather than bad outputFor flagging bugs which are compiler or service crashes or unclean exits, rather than bad outputFix AvailableA PR has been opened for this issueA PR has been opened for this issue
Milestone
Description
Bug Report
π Search Terms
maximum call stack size exceeded
π Version & Regression Information
4.5.0-dev.20211012
- This changed between versions 4.4.3 and 4.5.0-beta
β― Playground Link
Playground link with relevant code
π» Code
type _PrependNextNum<A extends Array<unknown>> = A['length'] extends infer T
? [T, ...A] extends [...infer X]
? X
: never
: never
type _Enumerate<A extends Array<unknown>, N extends number> = N extends A['length']
? A
: _Enumerate<_PrependNextNum<A>, N> & number
export type Enumerate<N extends number> = number extends N
? number
: _Enumerate<[], N> extends (infer E)[]
? E
: never
declare function foo<T extends unknown[]>(value: T): Enumerate<T['length']> {
return value.length
}
π Actual behavior
π Expected behavior
no crash
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptCrashFor flagging bugs which are compiler or service crashes or unclean exits, rather than bad outputFor flagging bugs which are compiler or service crashes or unclean exits, rather than bad outputFix AvailableA PR has been opened for this issueA PR has been opened for this issue