ts-type-forge
    Preparing search index...

    Type Alias SkipLast<N, T>

    SkipLast: SkipLastImpl<N, T, readonly []>

    Skips the last N elements from a readonly tuple T.

    Type Parameters

    • N extends number

      The number of elements to skip (must be a non-negative integer literal).

    • T extends readonly unknown[]

      The readonly tuple type.

    A new readonly tuple type containing the elements before the last N. If N is larger than the length of T, returns readonly [].

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