Type alias DropFirst<T, Options>

DropFirst<T, Options>: number extends T["length"]
    ? Options["$array"]
    : T["length"] extends 0
        ? Options["caseEmptyTuple"]
        : T["length"] extends 1
            ? []
            : T extends [any, ...(infer Tail)]
                ? Tail
                : never

⚗️ transform 🔢 customizable

Drops the first entry in the tuple T.

If the type is an array, the same array will be returned.

Type Parameters

Example

type R = DropFirst<[1, 2, 3]> // [2, 3]
type R = DropFirst<[string]> // []
type R = DropFirst<[]> // []
type R = DropFirst<string[]> // string[]

Type Param

Return type when T is Array. Default to T.

Type Param

Return type when T is an empty tuple. Default to [].

Generated using TypeDoc