Type alias IsNotStringLiteral<T, $O>

IsNotStringLiteral<T, $O>: $SpecialType<T, $MergeOptions<$O, {
    $else: IsNotStringLiteral.$<T, $O>;
    $then: $ResolveBranch<T, $O, [$Then]>;
}>>

🎭 predicate

Validate if T is not a string literal(s).

Type Parameters

Example

type R = IsNotStringLiteral<string> // true
type R = IsNotStringLiteral<'a'> // false
type R = IsNotStringLiteral<`${number}`> // false

type R = IsNotStringLiteral<never> // true
type R = IsNotStringLiteral<unknown> // true
type R = IsNotStringLiteral<'a' | boolean> // boolean

🔢 customize

Filter to ensure T is not a string literal(s), otherwise returns never.

Example

type R = IsNotStringLiteral<string, { selection: 'filter' }> // string
type R = IsNotStringLiteral<'a', { selection: 'filter' }> // never

type R = IsNotStringLiteral<never, { selection: 'filter' }> // never
type R = IsNotStringLiteral<unknown, { selection: 'filter' }> // unknown
type R = IsNotStringLiteral<'a' | boolean, { selection: 'filter' }> // boolean

🔢 customize:

Disable distribution of union types.

type R = IsNotStringLiteral<'abc' | 1> // boolean
type R = IsNotStringLiteral<'abc' | 1, { distributive: false }> // true

🔢 customize:

Check if T is exactly not a string literal, excluding template literals.

type R = IsNotStringLiteral<'${number}'> // false
type R = IsNotStringLiteral<'${number}', { exact: true }> // true

🔢 customize

Use unique branch identifiers to allow precise processing of the result.

Example

type R = IsNotStringLiteral<'abc', $IsNotStringLiteral.$Branch> // $Else
type R = IsNotStringLiteral<string, $IsNotStringLiteral.$Branch> // $Then

Generated using TypeDoc