-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
When was constraintDepth added? #33541
Comments
The file with the problem may be found here,
I'd like to again stress that this runs fine on TS 3.5.1 =( |
Also, further proof the functions in question are fine on TS 3.5.1, AnyhowStep/tsql@f9b73b2#diff-39b2092b0dd378cba12e94f7af61aba7R11-R573 The emit of that giant file is here (only 30+ lines), That file and 500+ others only take 27s to compile with TS 3.5.1, |
Thanks, @jack-williams , I'll start looking from there. |
This issue has been marked as 'Question' and has seen no recent activity. It has been automatically closed for house-keeping purposes. If you're still waiting on a response, questions are usually better suited to stackoverflow. |
Instead of trying to figure out which commit broke my The PR on my project, The file that has the new If anyone else is running into max depth errors with recursive types, trampolines may be a viable solution. Here's another example of trampolines being used, |
I was testing some of my code in TS 3.6 and TS 3.7
Code that worked fine in TS 3.5.1 now got the
Type_instantiation_is_excessively_deep_and_possibly_infinite
error instead.I decided to do a little investigation and noticed that there was this thing called
constraintDepth
with a limit of50
. This was what was triggering the error.I tried to disable the check for this
constraintDepth
and, predictably, got the error,However, if the code I wrote really was the problem, it shouldn't have run fine in 3.5.1. It should have also exceeded the max call stack size.
I don't have a minimal repro but I noticed something weird.
The following exceeds the constraint depth on 3.6 and 3.7,
However, the following does not,
Trying to nest function calls directly triggers the constraint depth error. But assigning it to a temporary variable is OK.
I'm a bit at a loss here and out of my depth (haha, depth).
constraintDepth
added?Code that worked fine in TS 3.5.1 now hits this
constraintDepth
error.Removing the limit causes the max call stack size to be exceeded.
So, it looks to me like there's a bug with the code surrounding the
constraintDepth
implementation. Hopefully, the answers to my questions can help me refactor my code to not hit the depth limit. Or maybe it'll expose a bug that needs fixing in the TS code base.The text was updated successfully, but these errors were encountered: