-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Union type inference lost in callback in else if
clause
#23532
Comments
It is working as intended, and the issue is the expression/lambda, not the else-if. The compiler has no guarantee that A solution would be to have an else block, then assign the correctly typed |
Ah of course, thanks! Although I should point out that this also fails when the field is |
The
|
See #11498 |
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed. |
TypeScript Version: 2.9.0-dev.20180418
Search Terms:
infer callback lost null union
Code
My attempt at a minimal reproduction - someone could probably do better:
Expected behavior:
No error
Actual behavior:
Playground Link: link
Related Issues:
The text was updated successfully, but these errors were encountered: