UNPKG

890 BTypeScriptView Raw
1import { Key } from '../Any/Key';
2import { Cast } from '../Any/Cast';
3import { Extends } from '../Any/Extends';
4import { Iteration } from '../Iteration/Iteration';
5import { IterationOf } from '../Iteration/IterationOf';
6import { Next } from '../Iteration/Next';
7import { Pos } from '../Iteration/Pos';
8import { List } from '../List/List';
9import { Length } from '../List/Length';
10import { At } from '../Any/At';
11/**
12 * @ignore
13 */
14declare type _Path<O, P extends List<Key>, I extends Iteration = IterationOf<0>> = {
15 0: _Path<At<O, P[Pos<I>]>, P, Next<I>>;
16 1: O;
17}[Extends<Pos<I>, Length<P>>];
18/**
19 * Get in `O` the type of nested properties
20 * @param O to be inspected
21 * @param Path to be followed
22 * @returns [[Any]]
23 * @example
24 * ```ts
25 * ```
26 */
27export declare type Path<O extends any, P extends List<Key>> = _Path<O & {}, P> extends infer X ? Cast<X, any> : never;
28export {};