1 | import { Cast } from '../Any/Cast';
|
---|
2 | import { List } from '../List/List';
|
---|
3 | import { Extends } from '../Any/Extends';
|
---|
4 | import { Select } from '../Union/Select';
|
---|
5 | import { Exclude } from '../Union/Exclude';
|
---|
6 | import { Iteration } from '../Iteration/Iteration';
|
---|
7 | import { IterationOf } from '../Iteration/IterationOf';
|
---|
8 | import { Pos } from '../Iteration/Pos';
|
---|
9 | import { Key } from '../Iteration/Key';
|
---|
10 | import { Append } from '../List/Append';
|
---|
11 | import { Next } from '../Iteration/Next';
|
---|
12 | /**
|
---|
13 | * @hidden
|
---|
14 | */
|
---|
15 | declare type AppendExists<O extends object, LN extends List, I extends Iteration> = Key<I> extends keyof O ? Append<LN, O[Key<I>]> : Pos<I> extends keyof O ? Append<LN, O[Pos<I>]> : LN;
|
---|
16 | /**
|
---|
17 | * @hidden
|
---|
18 | */
|
---|
19 | declare type ___ListOf<O extends object, K, LN extends List = [], I extends Iteration = IterationOf<0>> = {
|
---|
20 | 0: ___ListOf<O, Exclude<K, Key<I>>, AppendExists<O, LN, I>, Next<I>>;
|
---|
21 | 1: LN;
|
---|
22 | }[Extends<[K], [never]>];
|
---|
23 | /**
|
---|
24 | * @hidden
|
---|
25 | */
|
---|
26 | declare type __ListOf<O extends object> = number extends keyof O ? O[number][] : string extends keyof O ? O[string][] : symbol extends keyof O ? O[symbol][] : ___ListOf<O, Select<keyof O, number | `${number}`>>;
|
---|
27 | /**
|
---|
28 | * @hidden
|
---|
29 | */
|
---|
30 | export declare type _ListOf<O extends object> = __ListOf<O> extends infer X ? Cast<X, List> : never;
|
---|
31 | /**
|
---|
32 | * Transform an [[Object]] into a [[List]]
|
---|
33 | * (It will only pick numeric literal indexes)
|
---|
34 | * @param O to transform
|
---|
35 | * @returns [[List]]
|
---|
36 | * @example
|
---|
37 | * ```ts
|
---|
38 | * ```
|
---|
39 | */
|
---|
40 | export declare type ListOf<O extends object> = O extends unknown ? _ListOf<O> : never;
|
---|
41 | export {};
|
---|