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