UNPKG

1.08 kBTypeScriptView Raw
1import { IterationOf } from '../Iteration/IterationOf';
2import { Iteration } from '../Iteration/Iteration';
3import { Next } from '../Iteration/Next';
4import { Length } from './Length';
5import { Pos } from '../Iteration/Pos';
6import { Cast } from '../Any/Cast';
7import { List } from './List';
8import { Naked } from './_Internal';
9import { Extends } from '../Any/Extends';
10import { Append } from './Append';
11/**
12 * @hidden
13 */
14declare type __Zip<L extends List, L1 extends List, LN extends List = [], I extends Iteration = IterationOf<0>> = {
15 0: __Zip<L, L1, Append<LN, [L[Pos<I>], L1[Pos<I>]]>, Next<I>>;
16 1: LN;
17}[Extends<Pos<I>, Length<L>>];
18/**
19 * @hidden
20 */
21export declare type _Zip<L extends List, L1 extends List> = __Zip<Naked<L>, L1> extends infer X ? Cast<X, List> : never;
22/**
23 * Pair up the entries of `L` with `L1`
24 * @param L to pair up
25 * @param L1 to pair up with
26 * @returns [[List]]
27 * @example
28 * ```ts
29 * ```
30 */
31export declare type Zip<L extends List, L1 extends List> = L extends unknown ? L1 extends unknown ? _Zip<L, L1> : never : never;
32export {};