ts-type-forge
    Preparing search index...

    Type Alias Take<N, T>

    Take: TakeImpl<N, T, readonly []>

    Takes the first N elements from a readonly tuple T.

    Type Parameters

    • N extends number

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

    • T extends readonly unknown[]

      The readonly tuple type.

    A new readonly tuple type containing the first N elements. If N is larger than the length of T, returns T.

    type TK1 = Tuple.Take<2, [1, 2, 3]>; // readonly [1, 2]
    type TK2 = Tuple.Take<5, [1, 2, 3]>; // readonly [1, 2, 3]
    type TK3 = Tuple.Take<0, [1, 2, 3]>; // readonly []