You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expected behavior: No error nor warnings.
The following built-in Number functions should be defined as typeguards as they can only return true when their argument is a number: isFinite, isInteger, isNaN, isSafeInteger.
They currently typed as simple boolean and hence do not modify TS flow analysis.
TypeScript Version: 4.1.1-rc
Search Terms: Number typeguard
Code
Expected behavior: No error nor warnings.
The following built-in Number functions should be defined as typeguards as they can only return true when their argument is a number:
isFinite
,isInteger
,isNaN
,isSafeInteger
.They currently typed as simple
boolean
and hence do not modify TS flow analysis.Actual behavior: TS2531, objet is possibly null
Playground Link: https://www.typescriptlang.org/play?ts=4.1.0-beta#code/DYUwLgBAHhC8EBYBMECGBnCA7ArgWwCMQAnCAH2x2GAG4AoAOXyOIDoBLdAMXa3bBAAKKAEoIAMnHRWYAPYBlMMV4BzQSJpA
Related Issues:
The text was updated successfully, but these errors were encountered: