ts-type-forge
    Preparing search index...

    Type Alias SkipLast<N, T>

    SkipLast: IsFixedLengthList<T> extends true ? Tuple.SkipLast<N, T> : T

    Skips the last N elements from a readonly array or tuple T. If T is a tuple, it returns a new tuple containing the elements before the last N. If T is a general array, it returns the original array type T.

    Type Parameters

    • N extends number

      The number of elements to skip.

    • T extends readonly unknown[]

      The readonly array or tuple type.

    A new type containing elements before the last N (for tuples) or T (for arrays).

    type SL1 = List.SkipLast<1, [1, 2, 3]>; // readonly [1, 2]
    type SL2 = List.SkipLast<3, [1, 2, 3]>; // readonly []
    type SL3 = List.SkipLast<1, readonly string[]>; // readonly string[]