main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
1.0 KB
|
Line | |
---|
1 | import { Next } from '../Iteration/Next';
|
---|
2 | import { Prepend } from './Prepend';
|
---|
3 | import { IterationOf } from '../Iteration/IterationOf';
|
---|
4 | import { Iteration } from '../Iteration/Iteration';
|
---|
5 | import { Cast } from '../Any/Cast';
|
---|
6 | import { List } from './List';
|
---|
7 | import { Extends } from '../Any/Extends';
|
---|
8 | import { Pos } from '../Iteration/Pos';
|
---|
9 | /**
|
---|
10 | * @hidden
|
---|
11 | */
|
---|
12 | declare 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 | */
|
---|
19 | export 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 | */
|
---|
30 | export declare type Repeat<A extends any, N extends number, L extends List = []> = N extends unknown ? L extends unknown ? _Repeat<A, N, L> : never : never;
|
---|
31 | export {};
|
---|
Note:
See
TracBrowser
for help on using the repository browser.