UNPKG

1.05 kBTypeScriptView Raw
1import { Next } from '../Iteration/Next';
2import { Prepend } from './Prepend';
3import { IterationOf } from '../Iteration/IterationOf';
4import { Iteration } from '../Iteration/Iteration';
5import { Cast } from '../Any/Cast';
6import { List } from './List';
7import { Extends } from '../Any/Extends';
8import { Pos } from '../Iteration/Pos';
9/**
10 * @hidden
11 */
12declare type __Repeat<N extends number, A, L extends List = [], I extends Iteration = IterationOf<0>> = {
13 0: __Repeat<N, A, Prepend<L, A>, Next<I>>;
14 1: L;
15}[Extends<Pos<I>, N>];
16/**
17 * @hidden
18 */
19export declare type _Repeat<A extends any, N extends number, L extends List = []> = __Repeat<N, A, L> extends infer X ? Cast<X, List> : never;
20/**
21 * Fill a [[List]] with `N` times `A`
22 * @param A to fill with
23 * @param N to repeat it
24 * @param L (?=`[]`) to be filled
25 * @returns [[List]]
26 * @example
27 * ```ts
28 * ```
29 */
30export declare type Repeat<A extends any, N extends number, L extends List = []> = N extends unknown ? L extends unknown ? _Repeat<A, N, L> : never : never;
31export {};