Type alias Zip<L, L1>

Zip<L, L1>: _Zip<L, L1>

Pair up the entries of two tuples.

Zip takes two tuple types and returns a new tuple where each element is a pair containing the values from the same index in both tuples.

The resulting tuple length is determined by the shorter input tuple.

Type Parameters

  • L extends unknown[]

    The first tuple.

  • L1 extends unknown[]

    The second tuple.

Returns

A tuple of paired elements.

Example

type Result = Zip<[1, 2, 3], ['a', 'b', 'c']>;
// [[1,'a'], [2,'b'], [3,'c']]

Example

type Result = Zip<[1, 2], ['a', 'b', 'c']>;
// [[1,'a'], [2,'b']]

Example

type Result = Zip<[], [1, 2, 3]>;
// []