1 | export declare function invariant(condition: boolean, message: () => string): void;
|
2 | export declare class Context {
|
3 | private commands;
|
4 | constructor();
|
5 | get isEquals(): (x: any, y: any) => boolean;
|
6 | set isEquals(value: (x: any, y: any) => boolean);
|
7 | extend<T>(directive: string, fn: (param: any, old: T) => T): void;
|
8 | update<T, C extends CustomCommands<object> = never>(object: T, $spec: Spec<T, C>): T;
|
9 | }
|
10 | export declare const isEquals: any;
|
11 | export declare const extend: <T>(directive: string, fn: (param: any, old: T) => T) => void;
|
12 | declare const _default: <T, C extends CustomCommands<object> = never>(object: T, $spec: Spec<T, C>) => T;
|
13 | export default _default;
|
14 | export declare type CustomCommands<T> = T & {
|
15 | __noInferenceCustomCommandsBrand: any;
|
16 | };
|
17 | export declare type Spec<T, C extends CustomCommands<object> = never> = (T extends (Array<infer U> | ReadonlyArray<infer U>) ? ArraySpec<U, C> : T extends (Map<infer K, infer V> | ReadonlyMap<infer K, infer V>) ? MapSpec<K, V, C> : T extends (Set<infer X> | ReadonlySet<infer X>) ? SetSpec<X> : T extends object ? ObjectSpec<T, C> : never) | {
|
18 | $set: T;
|
19 | } | {
|
20 | $apply: (v: T) => T;
|
21 | } | ((v: T) => T) | (C extends CustomCommands<infer O> ? O : never);
|
22 | declare type ArraySpec<T, C extends CustomCommands<object>> = {
|
23 | $push: ReadonlyArray<T>;
|
24 | } | {
|
25 | $unshift: ReadonlyArray<T>;
|
26 | } | {
|
27 | $splice: ReadonlyArray<[number, number?] | [number, number, ...T[]]>;
|
28 | } | {
|
29 | [index: string]: Spec<T, C>;
|
30 | };
|
31 | declare type MapSpec<K, V, C extends CustomCommands<object>> = {
|
32 | $add: ReadonlyArray<[K, V]>;
|
33 | } | {
|
34 | $remove: ReadonlyArray<K>;
|
35 | } | {
|
36 | [key: string]: Spec<V, C>;
|
37 | };
|
38 | declare type SetSpec<T> = {
|
39 | $add: ReadonlyArray<T>;
|
40 | } | {
|
41 | $remove: ReadonlyArray<T>;
|
42 | };
|
43 | declare type ObjectSpec<T, C extends CustomCommands<object>> = {
|
44 | $toggle: ReadonlyArray<keyof T>;
|
45 | } | {
|
46 | $unset: ReadonlyArray<keyof T>;
|
47 | } | {
|
48 | $merge: Partial<T>;
|
49 | } | {
|
50 | [K in keyof T]?: Spec<T[K], C>;
|
51 | };
|
52 |
|
\ | No newline at end of file |