Type Alias IsSymbol<T, $O>

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

🎭 predicate

Validate if T is symbol.

Type Parameters

type R = IsSymbol<symbol> // true

type R = IsSymbol<never> // false
type R = IsSymbol<unknown> // false
type R = IsSymbol<symbol | number> // boolean

🔢 customize

Filter to ensure T is symbol, otherwise returns never.

type R = IsSymbol<symbol, { selection: 'filter' }> // symbol

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

type R = IsSymbol<symbol | null> // symbol

🔢 customize:

Disable distribution of union types.

type R = IsSymbol<symbol | 1> // boolean
type R = IsSymbol<symbol | 1, { distributive: false }> // false

🔢 customize

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

type R = IsSymbol<symbol, $SelectionBranch> // $Then
type R = IsSymbol<string, $SelectionBranch> // $Else