Conversion to number using unary plus doesn't work properly with null #21574
Labels
Suggestion
An idea for TypeScript
Working as Intended
The behavior described is the intended behavior; this is not a bug
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: