-
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
stack overflow in recursive type alias + lookup type #14837
Comments
But without this, TypeScript's type system is most probably not turing complete any more :( |
We should just detect ahead of time whether or not a given type relation check will eventually halt |
I've seen similar bug in Scala since 2.8 and fixed in 2.11 or so. Other (industry) languages also prioritize consistency over power. To achieve type system consistence we need to, sadly, abstain from Turing completeness. @hediet Your proof is very amazing and smart! |
Another piece of strange code, it compiles but should not. type Foo<T extends "true"> = { "true": Foo<'false'> }[T]; // should report error on 'false'
let f: Foo<"true"> = null!; |
@RyanCavanaugh Just an FYI, #14837 (comment) literally made me laugh out loud. Cheers! 🎉 |
Extracted from #14833
TypeScript Version: 2.2.1 / nightly (2.2.0-dev.201xxxxx)
Code
Expected behavior:
An error reporting cyclic dependency.
Actual behavior:
Throw RangeError: Maximum call stack size exceeded
The text was updated successfully, but these errors were encountered: