type R = IsNumber<number> // true
type R = IsNumber<1> // true
type R = IsNumber<never> // false
type R = IsNumber<unknown> // false
type R = IsNumber<string | boolean> // false
type R = IsNumber<string | number> // boolean
🔢 customize
Filter to ensure T
is number
or number
literals, otherwise returns never
.
type R = IsNumber<number, { selection: 'filter' }> // number
type R = IsNumber<1, { selection: 'filter' }> // 1
type R = IsNumber<never, { selection: 'filter' }> // never
type R = IsNumber<unknown, { selection: 'filter' }> // never
type R = IsNumber<string | boolean, { selection: 'filter' }> // never
type R = IsNumber<string | number> // number
🔢 customize:
Disable distribution of union types.
type R = IsNumber<number | 1> // boolean
type R = IsNumber<number | 1, { distributive: false }> // false
🔢 customize
Use unique branch identifiers to allow precise processing of the result.
🎭 predicate
Validate if
T
isnumber
ornumber
literals.