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