{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/4002","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/4002/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/4002/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/4002/events","html_url":"https://github.com/Microsoft/TypeScript/issues/4002","id":96856251,"number":4002,"title":"`isNaN` and `isFinite` should accept any value","user":{"login":"darrylring","id":2666,"avatar_url":"https://avatars.githubusercontent.com/u/2666?v=3","gravatar_id":"","url":"https://api.github.com/users/darrylring","html_url":"https://github.com/darrylring","followers_url":"https://api.github.com/users/darrylring/followers","following_url":"https://api.github.com/users/darrylring/following{/other_user}","gists_url":"https://api.github.com/users/darrylring/gists{/gist_id}","starred_url":"https://api.github.com/users/darrylring/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darrylring/subscriptions","organizations_url":"https://api.github.com/users/darrylring/orgs","repos_url":"https://api.github.com/users/darrylring/repos","events_url":"https://api.github.com/users/darrylring/events{/privacy}","received_events_url":"https://api.github.com/users/darrylring/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-07-23T16:46:16Z","updated_at":"2015-07-23T18:43:03Z","closed_at":null,"body":"According to the ES5.1 spec (15.1.2.4, 15.1.2.5), `isNaN(number)` and `isFinite(number)` perform the `ToNumber(number)` abstract operation before checking if `number` coerces to `NaN` or `±Infinity`.\r\n\r\nTo me, this implies that the argument to these functions can be any type. I think TypeScript should follow this as well. Why check if a variable is a number before checking if it's not a number (NaN)? Why manually coerce a variable into a number before calling a function that, according to the specification, does just that?"},"comment":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/comments/124206486","html_url":"https://github.com/Microsoft/TypeScript/issues/4002#issuecomment-124206486","issue_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/4002","id":124206486,"user":{"login":"darrylring","id":2666,"avatar_url":"https://avatars.githubusercontent.com/u/2666?v=3","gravatar_id":"","url":"https://api.github.com/users/darrylring","html_url":"https://github.com/darrylring","followers_url":"https://api.github.com/users/darrylring/followers","following_url":"https://api.github.com/users/darrylring/following{/other_user}","gists_url":"https://api.github.com/users/darrylring/gists{/gist_id}","starred_url":"https://api.github.com/users/darrylring/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darrylring/subscriptions","organizations_url":"https://api.github.com/users/darrylring/orgs","repos_url":"https://api.github.com/users/darrylring/repos","events_url":"https://api.github.com/users/darrylring/events{/privacy}","received_events_url":"https://api.github.com/users/darrylring/received_events","type":"User","site_admin":false},"created_at":"2015-07-23T18:43:03Z","updated_at":"2015-07-23T18:43:03Z","body":"I agree with both of you, but I would suggest it's a matter of degree. Let's ignore `Math.max()` because, as you say, the output can be `!==` to any of its inputs. I was not originally thinking about it, so my comment was just off-hand.\r\n\r\n`isFinite(\"hello\") == false` is neither unexpected nor unintended. The result makes sense and is meaningful. I understand the `+` coercion, but I do not agree that it is more clear about anything. Nothing plus a string is a number?"}}