type R = IsTemplateLiteral<string> // false
type R = IsTemplateLiteral<'foo'> // false
type R = IsTemplateLiteral<`a${number}`> // true
type R = IsTemplateLiteral<`a${number}` | `${bigint}c`> // true
type R = IsTemplateLiteral<never> // false
type R = IsTemplateLiteral<unknown> // false
type R = IsTemplateLiteral<`${number}` | boolean> // boolean
🔢 customize
Filter to ensure T
is a template literal(s), otherwise returns never
.
type R = IsTemplateLiteral<`${number}`, { selection: 'filter' }> // `${number}`
type R = IsTemplateLiteral<'a', { selection: 'filter' }> // never
🔢 customize:
Disable distribution of union types.
type R = IsTemplateLiteral<`${number}` | 1> // boolean
type R = IsTemplateLiteral<`${number}` | 1, { distributive: false }> // false
🔢 customize
Use unique branch identifiers to allow precise processing of the result.
🎭 validate
Validate if
T
is a template literal(s).