ts-type-forge
    Preparing search index...

    Type Alias ButLast<A>

    ButLast: Tuple.ButLast<A>

    Gets a new tuple/array type containing all elements of A except the last one. Delegates to Tuple.ButLast.

    Type Parameters

    • A extends readonly unknown[]

      The readonly array or tuple type.

    A new type with the last element removed.

    type BL1 = List.ButLast<[1, 2, 3]>; // readonly [1, 2]
    type BL2 = List.ButLast<readonly string[]>; // readonly string[] (unchanged for general arrays)
    type BL3 = List.ButLast<[1]>; // readonly []
    type BL4 = List.ButLast<[]>; // readonly []