-
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
RangeError: Maximum call stack size exceeded with union type #23777
Comments
Looks like the types are deep enough to run out of stack. on my box, raising the stack limit from default (984) to 1001 gets the types to check. We can look and see if there are unnecessary calls that we can remove and limit the factor we add to the stack size. but ultimately, in a structural type system, eventually there is a limit to hit. |
What I try to achieve is a simple exclusive union type: it's just a few interfaces with different |
@sandersn @mhegazy The culprit here appears to be some logic in |
@ahejlsberg An array or an object (same issue with an object as |
@cyrilletuzi I'm not sure I understand what you mean. |
TypeScript Version: 2.7.2 and 2.9.0-dev.20180430
Search Terms:
RangeError: Maximum call stack size exceeded
Code
git clone https://github.com/cyrilletuzi/angular-async-local-storage.git
cd angular-async-local-storage
git checkout newschema
npm test
> OKsrc/lib/src/service/validation/json-validation.spec.ts
lines 570-576npm test
Actual behavior:
RangeError: Maximum call stack size exceeded
Expected behavior:
Should not crash.
Context:
Trying to do an union type for JSONSchema.
When giving a wrong
type
value with a primitive, it's OK (error reported in VS Code but tsc not crashing):But when giving a wrong
type
value with an array or object, no error is shown in VS Code (as if typings were valid) andtsc
crashes with the error above:What is strange is when doing the same in a more simpler file the typing error is reported.
The text was updated successfully, but these errors were encountered: