main
Last change
on this file since 75f5086 was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
832 bytes
|
Rev | Line | |
---|
[d24f17c] | 1 | import { Key } from '../../Any/Key';
|
---|
| 2 | import { _Pick as _OPick } from '../Pick';
|
---|
| 3 | import { List } from '../../List/List';
|
---|
| 4 | import { Tail } from '../../List/Tail';
|
---|
| 5 | import { BuiltIn } from '../../Misc/BuiltIn';
|
---|
| 6 | import { _ListOf } from '../ListOf';
|
---|
| 7 | /**
|
---|
| 8 | * @hidden
|
---|
| 9 | */
|
---|
| 10 | declare type PickAt<O, Path extends List<Key>> = [
|
---|
| 11 | ] extends Path ? O : O extends BuiltIn ? O : O extends List ? _ListOf<{
|
---|
| 12 | [K in keyof _OPick<O, Path[0]>]: PickAt<O[K], Tail<Path>>;
|
---|
| 13 | }> : O extends object ? {
|
---|
| 14 | [K in keyof _OPick<O, Path[0]>]: PickAt<O[K], Tail<Path>>;
|
---|
| 15 | } : O;
|
---|
| 16 | /**
|
---|
| 17 | * Extract out of `O` the fields at `Path`
|
---|
| 18 | * @param O to extract from
|
---|
| 19 | * @param Path to be followed
|
---|
| 20 | * @returns [[Object]]
|
---|
| 21 | * @example
|
---|
| 22 | * ```ts
|
---|
| 23 | * ```
|
---|
| 24 | */
|
---|
| 25 | export declare type Pick<O extends object, Path extends List<Key>> = Path extends unknown ? PickAt<O, Path> : never;
|
---|
| 26 | export {};
|
---|
Note:
See
TracBrowser
for help on using the repository browser.