Skip to content

isNaN only takes number and does not implement typeguard #15173

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

Closed
npenin opened this issue Apr 13, 2017 · 1 comment
Closed

isNaN only takes number and does not implement typeguard #15173

npenin opened this issue Apr 13, 2017 · 1 comment
Labels
Duplicate An existing issue was already created

Comments

@npenin
Copy link

npenin commented Apr 13, 2017

TypeScript Version: 2.2.2

Code

var obj='1'

if(!isNaN(obj))
{
   ///here obj should be a number or equivalent
}

Expected behavior:

  • isNaN should take any kind of data, not only numbers
  • isNaN should implement typeguards so that in the if statement, obj is considered as a number or equivalent

Actual behavior:

  • isNaN(obj) breaks on compilation
@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Apr 13, 2017
@RyanCavanaugh
Copy link
Member

#12302 / #13227

Please search before logging new issues, both of the things here have been covered before
image

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

2 participants