-
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
Conversion to number using unary plus doesn't work properly with null #21574
Comments
#7989 tracks the general operator interaction with nullable types.. but we chose to allow |
Related: #20131 -- although that case is requesting the compiler to be more strict. |
@mhegazy, |
I think i miss linked this issue to #7989. we should think about this one more time.. |
Related #20754 We like the behavior as-is, inconsistency notwithstanding |
TypeScript Version: 2.8.0-dev.20180202
Code
Expected behavior:
All tests must be ok.
Actual behavior:
Test 4 isn't ok. Typescript says: Object is possibly 'null'.
Playground Link: https://www.typescriptlang.org/play/index.html#src=%2F%2F%20Test%201%0D%0AString(null)%3B%0D%0A%0D%0A%2F%2F%20Test%202%0D%0ANumber(null)%3B%0D%0A%0D%0A%2F%2F%20Test%203%0D%0A''%20%2B%20null%3B%0D%0A%0D%0A%2F%2F%20Test%204%0D%0A%2B%20null%3B
The text was updated successfully, but these errors were encountered: