-
Notifications
You must be signed in to change notification settings - Fork 12.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stack overflow on certain platforms #45576
Comments
I managed to get a simpler repro by replacing type SomeType = number | string | SomeType[]; |
Is the issue here the stack overflow in the playground? Best I can tell, the excessive depth error is expected behavior and also happens with versions prior to 4.4. |
BTW, I'm not seeing the stack overflow in the playground. |
Hm - there's a few things to note I think.
|
On nightly or 4.4.1-rc? We've increased the maximum instantiation depth from 50 to 500 in nightly, so that may have something to do with it. |
I guess playing with the depth limiter is still an open area of investigation |
The definition of interface IDBArrayKey extends Array<IDBValidKey> {}
type IDBValidKey = number | string | Date | BufferSource | IDBArrayKey; which does not trigger the infinite instantiation, to type IDBValidKey = number | string | Date | BufferSource | IDBValidKey[]; which does trigger the infinite instantiation, which prompts a question and a hypothesis:
|
I'm running into a similar issue. When I run Everything was working fine - this just happens when I attempt to upgrade to typescript FWIW, recursive types should definitely be allowed. They're a standard part of any programming language (more generally, Context Free Grammars) and it's very common to do this (e.g. with datastructures like trees, or compilers, etc.). e.g. it's 100% valid to have:
Unfortunately the stacktrace I get doesn't give me any indication of which type is causing the issue:
|
I just verified I don't get this |
From @h-joo at #45571
With
tsc
or in the editorOr in the playground for me:
The text was updated successfully, but these errors were encountered: