Type Alias IsArray<T, $O>

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

🎭 predicate

Validate that T is an array.

Type Parameters

type R = IsArray<number[]> // true
type R = IsArray<[1]> // true

type R = IsArray<number> // false

🔢 customize

Filter to ensure T is an array, otherwise returns never.

type R = IsArray<number[], { selection: 'filter' }> // number[]
type R = IsArray<number, { selection: 'filter' }> // never

🔢 customize

Disable distribution of union types.

type R = IsArray<number[] | 1> // boolean
type R = IsArray<number[] | 1, { distributive: false }> // false

🔢 customize

Check if T is exactly an array, excluding tuple.

type R = IsArray<[]> // true
type R = IsArray<[], { exact: true }> // false

🔢 customize

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

type R = IsArray<number[], IsArray.$Branch> // $Then
type R = IsArray<number, IsArray.$Branch> // $Else