ts-type-forge
    Preparing search index...

    Type Alias Partition<N, T>

    Partition: Tuple.Partition<N, T>

    Partitions a readonly array or tuple T into sub-arrays/tuples of length N. Delegates to Tuple.Partition.

    Type Parameters

    • N extends number

      The desired size of each partition (must be a positive integer literal).

    • T extends readonly unknown[]

      The readonly array or tuple type to partition.

    A readonly array/tuple where each element is a sub-array/tuple of length N.

    type P1 = List.Partition<2, [1, 2, 3, 4, 5]>; // readonly [[1, 2], [3, 4], [5]]
    type P2 = List.Partition<3, readonly number[]>; // readonly (readonly number[])[]
    type P3 = List.Partition<1, [1, 2]>; // readonly [[1], [2]]