According to the spec (see references below), isNaN() should be able to take any kind of value, which would be coerced into a number (using something like Number(value), which seems to make sense from my tests).
Forcing the parameter to be number breaks legacy code which relies on being able to pass string arguments to isNaN().
function f(value: string) {
if (isNaN(value)) { // compilation error, but should be OK
...
}
}
Removing the string type from the value parameter admittedly fixes the compilation error, but breaks the "no implicity any" rule.
References:
According to the spec (see references below),
isNaN()should be able to take any kind of value, which would be coerced into a number (using something likeNumber(value), which seems to make sense from my tests).Forcing the parameter to be
numberbreaks legacy code which relies on being able to pass string arguments toisNaN().Removing the
stringtype from thevalueparameter admittedly fixes the compilation error, but breaks the "no implicity any" rule.References:
TypeScript/lib/lib.es5.d.ts
Line 53 in f8083d2