Fix NaN .is() return

This commit is contained in:
Filip Skokan 2022-02-21 18:45:25 +01:00
parent 04ccf21dba
commit 37e097dd5f
2 changed files with 3 additions and 2 deletions

View file

@ -50,6 +50,7 @@ const objectTypeNames = [
'FormData',
'URLSearchParams',
'HTMLElement',
'NaN',
...typedArrayTypeNames
] as const;
@ -110,7 +111,7 @@ function is(value: unknown): TypeName {
case 'string':
return 'string';
case 'number':
return 'number';
return Number.isNaN(value) ? 'NaN' : 'number';
case 'boolean':
return 'boolean';
case 'function':

View file

@ -446,7 +446,7 @@ const types = new Map<string, Test>([
NaN,
Number.NaN
],
typename: 'number',
typename: 'NaN',
typeDescription: AssertionTypeDescription.nan
}],
['nullOrUndefined', {