-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Type narrowing for Tuple-Elements #12849
Comments
Same underlying issue as #14957 |
Should I close this in favour of #14957 ? |
I would leave them both open. though both would be addressed by the same change, ppl tend to think of them as two separate scenarios. this way we have a landing point for users searching for similar issues. |
This would work if it weren't for the destructuring. Our CFA algorithm isn't able to correlate values from different places like this; this comes up from time to time but doesn't seem to merit the required work at this time. |
TypeScript Version: nightly (2.2.0-dev.20161210)
Code
Expected behavior:
b
to be narrowed tonumber
and the resulting code to throw no compiler errorsActual behavior:
b
has typenumber | string
and thus the code throws a compiler error complaining thatb++
can only apply to numbersThe text was updated successfully, but these errors were encountered: