We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
TypeScript Version: nightly (2.1.0-dev.20160731)
Related to (duplicte of) #9861
Code
function foo(value: string | number) { if (typeof value !== 'string') { return; } else { // value here has type string. } // value here has type string | number. }
Expected behavior:
Both value in else and the rest of the function should be narrowed to string.
value
else
string
Actual behavior:
Only value in else is narrowed.
The text was updated successfully, but these errors were encountered:
I can't reproduce this in 2.1.0-dev.20160731. This is what I see:
2.1.0-dev.20160731
function foo(value: string | number) { if (typeof value !== 'string') { value // value is number return; } else { value // value is string } value // value is string }
Sorry, something went wrong.
Strange then, can't reproduce it myself. Might be some misconfiguration.
No branches or pull requests
TypeScript Version: nightly (2.1.0-dev.20160731)
Related to (duplicte of) #9861
Code
Expected behavior:
Both
value
inelse
and the rest of the function should be narrowed tostring
.Actual behavior:
Only
value
inelse
is narrowed.The text was updated successfully, but these errors were encountered: