-
-
Notifications
You must be signed in to change notification settings - Fork 105
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
Unclear error message when checking NaN against the number type #231
Comments
I agree. That should be improved. I think we should do both suggestions. |
@sindresorhus would you prefer the first suggestion to be a breaking change in |
How would you fix it in |
@sindresorhus change https://github.com/sindresorhus/is/blob/v4.4.0/source/index.ts#L112-L113 to
|
Ah yes. Let's fix it in |
Ok, ignore #232 then. |
See comment update. |
When testing
NaN
againstow.number
, the following error message is emitted:This behaviour can be verified by running this two line snippet in the Node REPL:
I think that this error message would be quite confusing for those who encounter it. I see two possible ways to solve this problem:
NaN
case to be something along the lines of:Expected argument to be of type `number`, but received `NaN`.
ow.number.nan
andow.number.not.nan
checks.The text was updated successfully, but these errors were encountered: