1 | import { IterationOf } from '../Iteration/IterationOf';
|
2 | import { Iteration } from '../Iteration/Iteration';
|
3 | import { Next } from '../Iteration/Next';
|
4 | import { Pos } from '../Iteration/Pos';
|
5 | import { At } from '../Any/At';
|
6 | import { Cast } from '../Any/Cast';
|
7 | import { NonNullable } from '../Union/NonNullable';
|
8 | import { Update } from '../List/Update';
|
9 | import { Key } from '../Iteration/Key';
|
10 | import { Key as AKey } from '../Any/Key';
|
11 | import { List } from '../List/List';
|
12 | import { Length } from '../List/Length';
|
13 | import { Extends } from '../Any/Extends';
|
14 |
|
15 |
|
16 |
|
17 | declare type ValidatePath<O, Path extends List<AKey>, I extends Iteration> = Update<Path, Key<I>, [
|
18 | At<O & {}, Path[Pos<I>]>
|
19 | ] extends [never] ? keyof O : Path[Pos<I>]>;
|
20 |
|
21 |
|
22 |
|
23 | declare type __ValidPath<O, Path extends List<AKey>, I extends Iteration = IterationOf<0>> = {
|
24 | 0: __ValidPath<NonNullable<At<O & {}, Path[Pos<I>]>>, ValidatePath<O, Path, I>, Next<I>>;
|
25 | 1: Path;
|
26 | }[Extends<Pos<I>, Length<Path>>];
|
27 |
|
28 |
|
29 |
|
30 | export declare type _ValidPath<O extends object, Path extends List<AKey>> = __ValidPath<O, Path> extends infer X ? Cast<X, List<AKey>> : never;
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 | export declare type ValidPath<O extends object, Path extends List<AKey>> = O extends unknown ? Path extends unknown ? _ValidPath<O, Path> : never : never;
|
60 | export {};
|