type-plus
    Preparing search index...

    Type Alias DropLast<T, Cases>

    DropLast: number extends T["length"]
        ? Cases["$array"]
        : T["length"] extends 0
            ? Cases["caseEmptyTuple"]
            : T["length"] extends 1
                ? []
                : T extends [...(infer Heads), any] ? Heads : never

    ⚗️ transform 🔢 customizable

    Drops the last entry in the tuple T.

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

    Type Parameters

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

    Return type when T is Array. Default to T.

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