mobx-state-tree 3.12.2 → 3.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/README.md +103 -23
  2. package/dist/core/action.d.ts +50 -48
  3. package/dist/core/actionContext.d.ts +27 -0
  4. package/dist/core/flow.d.ts +14 -30
  5. package/dist/core/json-patch.d.ts +36 -36
  6. package/dist/core/mst-operations.d.ts +451 -444
  7. package/dist/core/node/BaseNode.d.ts +1 -1
  8. package/dist/core/node/Hook.d.ts +17 -1
  9. package/dist/core/node/create-node.d.ts +1 -1
  10. package/dist/core/node/identifier-cache.d.ts +1 -1
  11. package/dist/core/node/livelinessChecking.d.ts +37 -37
  12. package/dist/core/node/node-utils.d.ts +28 -28
  13. package/dist/core/node/object-node.d.ts +1 -1
  14. package/dist/core/node/scalar-node.d.ts +1 -1
  15. package/dist/core/process.d.ts +45 -45
  16. package/dist/core/type/type-checker.d.ts +30 -30
  17. package/dist/core/type/type.d.ts +162 -177
  18. package/dist/index.d.ts +3 -3
  19. package/dist/internal.d.ts +37 -35
  20. package/dist/middlewares/create-action-tracking-middleware.d.ts +24 -22
  21. package/dist/middlewares/createActionTrackingMiddleware2.d.ts +34 -0
  22. package/dist/middlewares/on-action.d.ts +87 -79
  23. package/dist/mobx-state-tree.js +6285 -5985
  24. package/dist/mobx-state-tree.min.js +16 -1
  25. package/dist/mobx-state-tree.module.js +6234 -5938
  26. package/dist/mobx-state-tree.umd.js +6263 -5985
  27. package/dist/mobx-state-tree.umd.min.js +16 -1
  28. package/dist/types/complex-types/array.d.ts +52 -51
  29. package/dist/types/complex-types/map.d.ts +80 -79
  30. package/dist/types/complex-types/model.d.ts +133 -125
  31. package/dist/types/index.d.ts +29 -29
  32. package/dist/types/primitives.d.ts +81 -81
  33. package/dist/types/utility-types/custom.d.ts +60 -60
  34. package/dist/types/utility-types/enumeration.d.ts +5 -5
  35. package/dist/types/utility-types/frozen.d.ts +11 -11
  36. package/dist/types/utility-types/identifier.d.ts +44 -44
  37. package/dist/types/utility-types/late.d.ts +10 -10
  38. package/dist/types/utility-types/literal.d.ts +25 -25
  39. package/dist/types/utility-types/maybe.d.ts +26 -26
  40. package/dist/types/utility-types/optional.d.ts +20 -20
  41. package/dist/types/utility-types/reference.d.ts +41 -47
  42. package/dist/types/utility-types/refinement.d.ts +10 -10
  43. package/dist/types/utility-types/snapshotProcessor.d.ts +61 -61
  44. package/dist/types/utility-types/union.d.ts +55 -55
  45. package/dist/utils.d.ts +4 -4
  46. package/package.json +16 -12
@@ -1,79 +1,80 @@
1
- import { IInterceptor, IKeyValueMap, IMapDidChange, IMapWillChange, Lambda } from "mobx";
2
- import { IAnyType, IType, ExtractC, ExtractS, ExtractTWithSTN, ExtractCSTWithSTN, ExtractTWithoutSTN } from "../../internal";
3
- /** @hidden */
4
- export interface IMapType<IT extends IAnyType> extends IType<IKeyValueMap<ExtractC<IT>> | undefined, IKeyValueMap<ExtractS<IT>>, IMSTMap<IT>> {
5
- }
6
- /** @hidden */
7
- export interface IMSTMap<IT extends IAnyType> {
8
- clear(): void;
9
- delete(key: string): boolean;
10
- forEach(callbackfn: (value: ExtractTWithSTN<IT>, key: string, map: this) => void, thisArg?: any): void;
11
- get(key: string): ExtractTWithSTN<IT> | undefined;
12
- has(key: string): boolean;
13
- set(key: string, value: ExtractCSTWithSTN<IT>): this;
14
- readonly size: number;
15
- put(value: ExtractCSTWithSTN<IT>): ExtractTWithSTN<IT>;
16
- keys(): IterableIterator<string>;
17
- values(): IterableIterator<ExtractTWithSTN<IT>>;
18
- entries(): IterableIterator<[string, ExtractTWithSTN<IT>]>;
19
- [Symbol.iterator](): IterableIterator<[string, ExtractTWithSTN<IT>]>;
20
- /** Merge another object into this map, returns self. */
21
- merge(other: IMSTMap<IType<any, any, ExtractTWithoutSTN<IT>>> | IKeyValueMap<ExtractCSTWithSTN<IT>> | any): this;
22
- replace(values: IMSTMap<IType<any, any, ExtractTWithoutSTN<IT>>> | IKeyValueMap<ExtractCSTWithSTN<IT>> | any): this;
23
- /**
24
- * Returns a plain object that represents this map.
25
- * Note that all the keys being stringified.
26
- * If there are duplicating keys after converting them to strings, behaviour is undetermined.
27
- */
28
- toPOJO(): IKeyValueMap<ExtractS<IT>>;
29
- toJSON(): IKeyValueMap<ExtractS<IT>>;
30
- /**
31
- * Returns a shallow non observable object clone of this map.
32
- * Note that the values migth still be observable. For a deep clone use mobx.toJS.
33
- */
34
- toJS(): Map<string, ExtractTWithSTN<IT>>;
35
- toString(): string;
36
- [Symbol.toStringTag]: "Map";
37
- /**
38
- * Observes this object. Triggers for the events 'add', 'update' and 'delete'.
39
- * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe
40
- * for callback details
41
- */
42
- observe(listener: (changes: IMapDidChange<string, ExtractTWithSTN<IT>>) => void, fireImmediately?: boolean): Lambda;
43
- intercept(handler: IInterceptor<IMapWillChange<string, ExtractTWithSTN<IT>>>): Lambda;
44
- }
45
- /**
46
- * `types.map` - Creates a key based collection type who's children are all of a uniform declared type.
47
- * If the type stored in a map has an identifier, it is mandatory to store the child under that identifier in the map.
48
- *
49
- * This type will always produce [observable maps](https://mobx.js.org/refguide/map.html)
50
- *
51
- * Example:
52
- * ```ts
53
- * const Todo = types.model({
54
- * id: types.identifier,
55
- * task: types.string
56
- * })
57
- *
58
- * const TodoStore = types.model({
59
- * todos: types.map(Todo)
60
- * })
61
- *
62
- * const s = TodoStore.create({ todos: {} })
63
- * unprotect(s)
64
- * s.todos.set(17, { task: "Grab coffee", id: 17 })
65
- * s.todos.put({ task: "Grab cookie", id: 18 }) // put will infer key from the identifier
66
- * console.log(s.todos.get(17).task) // prints: "Grab coffee"
67
- * ```
68
- *
69
- * @param subtype
70
- * @returns
71
- */
72
- export declare function map<IT extends IAnyType>(subtype: IT): IMapType<IT>;
73
- /**
74
- * Returns if a given value represents a map type.
75
- *
76
- * @param type
77
- * @returns `true` if it is a map type.
78
- */
79
- export declare function isMapType<Items extends IAnyType = IAnyType>(type: IAnyType): type is IMapType<Items>;
1
+ import { IInterceptor, IKeyValueMap, IMapDidChange, IMapWillChange, Lambda } from "mobx";
2
+ import { IAnyType, IType, ExtractCSTWithSTN, IHooksGetter } from "../../internal";
3
+ /** @hidden */
4
+ export interface IMapType<IT extends IAnyType> extends IType<IKeyValueMap<IT["CreationType"]> | undefined, IKeyValueMap<IT["SnapshotType"]>, IMSTMap<IT>> {
5
+ hooks(hooks: IHooksGetter<IMSTMap<IT>>): IMapType<IT>;
6
+ }
7
+ /** @hidden */
8
+ export interface IMSTMap<IT extends IAnyType> {
9
+ clear(): void;
10
+ delete(key: string): boolean;
11
+ forEach(callbackfn: (value: IT["Type"], key: string, map: this) => void, thisArg?: any): void;
12
+ get(key: string): IT["Type"] | undefined;
13
+ has(key: string): boolean;
14
+ set(key: string, value: ExtractCSTWithSTN<IT>): this;
15
+ readonly size: number;
16
+ put(value: ExtractCSTWithSTN<IT>): IT["Type"];
17
+ keys(): IterableIterator<string>;
18
+ values(): IterableIterator<IT["Type"]>;
19
+ entries(): IterableIterator<[string, IT["Type"]]>;
20
+ [Symbol.iterator](): IterableIterator<[string, IT["Type"]]>;
21
+ /** Merge another object into this map, returns self. */
22
+ merge(other: IMSTMap<IType<any, any, IT["TypeWithoutSTN"]>> | IKeyValueMap<ExtractCSTWithSTN<IT>> | any): this;
23
+ replace(values: IMSTMap<IType<any, any, IT["TypeWithoutSTN"]>> | IKeyValueMap<ExtractCSTWithSTN<IT>> | any): this;
24
+ /**
25
+ * Returns a plain object that represents this map.
26
+ * Note that all the keys being stringified.
27
+ * If there are duplicating keys after converting them to strings, behaviour is undetermined.
28
+ */
29
+ toPOJO(): IKeyValueMap<IT["SnapshotType"]>;
30
+ toJSON(): IKeyValueMap<IT["SnapshotType"]>;
31
+ /**
32
+ * Returns a shallow non observable object clone of this map.
33
+ * Note that the values might still be observable. For a deep clone use mobx.toJS.
34
+ */
35
+ toJS(): Map<string, IT["Type"]>;
36
+ toString(): string;
37
+ [Symbol.toStringTag]: "Map";
38
+ /**
39
+ * Observes this object. Triggers for the events 'add', 'update' and 'delete'.
40
+ * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe
41
+ * for callback details
42
+ */
43
+ observe(listener: (changes: IMapDidChange<string, IT["Type"]>) => void, fireImmediately?: boolean): Lambda;
44
+ intercept(handler: IInterceptor<IMapWillChange<string, IT["Type"]>>): Lambda;
45
+ }
46
+ /**
47
+ * `types.map` - Creates a key based collection type who's children are all of a uniform declared type.
48
+ * If the type stored in a map has an identifier, it is mandatory to store the child under that identifier in the map.
49
+ *
50
+ * This type will always produce [observable maps](https://mobx.js.org/refguide/map.html)
51
+ *
52
+ * Example:
53
+ * ```ts
54
+ * const Todo = types.model({
55
+ * id: types.identifier,
56
+ * task: types.string
57
+ * })
58
+ *
59
+ * const TodoStore = types.model({
60
+ * todos: types.map(Todo)
61
+ * })
62
+ *
63
+ * const s = TodoStore.create({ todos: {} })
64
+ * unprotect(s)
65
+ * s.todos.set(17, { task: "Grab coffee", id: 17 })
66
+ * s.todos.put({ task: "Grab cookie", id: 18 }) // put will infer key from the identifier
67
+ * console.log(s.todos.get(17).task) // prints: "Grab coffee"
68
+ * ```
69
+ *
70
+ * @param subtype
71
+ * @returns
72
+ */
73
+ export declare function map<IT extends IAnyType>(subtype: IT): IMapType<IT>;
74
+ /**
75
+ * Returns if a given value represents a map type.
76
+ *
77
+ * @param type
78
+ * @returns `true` if it is a map type.
79
+ */
80
+ export declare function isMapType<Items extends IAnyType = IAnyType>(type: IAnyType): type is IMapType<Items>;
@@ -1,125 +1,133 @@
1
- import { IAnyType, IType, ExtractC, ExtractS, _CustomOrOther, _NotCustomized, IsOptionalType, ExtractTWithSTN, Instance } from "../../internal";
2
- /** @hidden */
3
- export interface ModelProperties {
4
- [key: string]: IAnyType;
5
- }
6
- /** @hidden */
7
- export declare type ModelPrimitive = string | number | boolean | Date;
8
- /** @hidden */
9
- export interface ModelPropertiesDeclaration {
10
- [key: string]: ModelPrimitive | IAnyType;
11
- }
12
- /**
13
- * Unmaps syntax property declarations to a map of { propName: IType }
14
- *
15
- * @hidden
16
- */
17
- export declare type ModelPropertiesDeclarationToProperties<T extends ModelPropertiesDeclaration> = {
18
- [K in keyof T]: T[K] extends string ? IType<string | undefined, string, string> : T[K] extends number ? IType<number | undefined, number, number> : T[K] extends boolean ? IType<boolean | undefined, boolean, boolean> : T[K] extends Date ? IType<number | Date | undefined, number, Date> : T[K] extends IType<infer _TC, infer _TS, infer _TT> ? T[K] : never;
19
- };
20
- /**
21
- * Maps property types to the snapshot, including omitted optional attributes
22
- * @hidden
23
- */
24
- export declare type RequiredPropNames<P extends ModelProperties> = {
25
- [K in keyof P]: IsOptionalType<P[K]> extends true ? never : K;
26
- }[keyof P];
27
- /** @hidden */
28
- export declare type RequiredProps<P extends ModelProperties> = Pick<P, RequiredPropNames<P>>;
29
- /** @hidden */
30
- export declare type RequiredPropsObject<P extends ModelProperties> = {
31
- [K in keyof RequiredProps<P>]: P[K];
32
- };
33
- /** @hidden */
34
- export declare type OptionalPropNames<P extends ModelProperties> = {
35
- [K in keyof P]: IsOptionalType<P[K]> extends true ? K : never;
36
- }[keyof P];
37
- /** @hidden */
38
- export declare type OptionalProps<P extends ModelProperties> = Pick<P, OptionalPropNames<P>>;
39
- /** @hidden */
40
- export declare type OptionalPropsObject<P extends ModelProperties> = {
41
- [K in keyof OptionalProps<P>]?: P[K];
42
- };
43
- /** @hidden */
44
- export declare type ExtractCFromProps<P extends ModelProperties> = {
45
- [k in keyof P]: ExtractC<P[k]>;
46
- };
47
- /** @hidden */
48
- export declare type ModelCreationType<P extends ModelProperties> = ExtractCFromProps<RequiredPropsObject<P> & OptionalPropsObject<P>>;
49
- /** @hidden */
50
- export declare type ModelCreationType2<P extends ModelProperties, CustomC> = _CustomOrOther<CustomC, ModelCreationType<P>>;
51
- /** @hidden */
52
- export declare type ModelSnapshotType<P extends ModelProperties> = {
53
- [K in keyof P]: ExtractS<P[K]>;
54
- };
55
- /** @hidden */
56
- export declare type ModelSnapshotType2<P extends ModelProperties, CustomS> = _CustomOrOther<CustomS, ModelSnapshotType<P>>;
57
- /**
58
- * @hidden
59
- * we keep this separate from ModelInstanceType to shorten model instance types generated declarations
60
- */
61
- export declare type ModelInstanceTypeProps<P extends ModelProperties> = {
62
- [K in keyof P]: ExtractTWithSTN<P[K]>;
63
- };
64
- /**
65
- * @hidden
66
- * do not transform this to an interface or model instance type generated declarations will be longer
67
- */
68
- export declare type ModelInstanceType<P extends ModelProperties, O> = ModelInstanceTypeProps<P> & O;
69
- /** @hidden */
70
- export interface ModelActions {
71
- [key: string]: Function;
72
- }
73
- export interface IModelType<PROPS extends ModelProperties, OTHERS, CustomC = _NotCustomized, CustomS = _NotCustomized> extends IType<ModelCreationType2<PROPS, CustomC>, ModelSnapshotType2<PROPS, CustomS>, ModelInstanceType<PROPS, OTHERS>> {
74
- readonly properties: PROPS;
75
- named(newName: string): IModelType<PROPS, OTHERS, CustomC, CustomS>;
76
- props<PROPS2 extends ModelPropertiesDeclaration>(props: PROPS2): IModelType<PROPS & ModelPropertiesDeclarationToProperties<PROPS2>, OTHERS, CustomC, CustomS>;
77
- views<V extends Object>(fn: (self: Instance<this>) => V): IModelType<PROPS, OTHERS & V, CustomC, CustomS>;
78
- actions<A extends ModelActions>(fn: (self: Instance<this>) => A): IModelType<PROPS, OTHERS & A, CustomC, CustomS>;
79
- volatile<TP extends object>(fn: (self: Instance<this>) => TP): IModelType<PROPS, OTHERS & TP, CustomC, CustomS>;
80
- extend<A extends ModelActions = {}, V extends Object = {}, VS extends Object = {}>(fn: (self: Instance<this>) => {
81
- actions?: A;
82
- views?: V;
83
- state?: VS;
84
- }): IModelType<PROPS, OTHERS & A & V & VS, CustomC, CustomS>;
85
- /** @deprecated See `types.snapshotProcessor` */
86
- preProcessSnapshot<NewC = ModelCreationType2<PROPS, CustomC>>(fn: (snapshot: NewC) => ModelCreationType2<PROPS, CustomC>): IModelType<PROPS, OTHERS, NewC, CustomS>;
87
- /** @deprecated See `types.snapshotProcessor` */
88
- postProcessSnapshot<NewS = ModelSnapshotType2<PROPS, CustomS>>(fn: (snapshot: ModelSnapshotType2<PROPS, CustomS>) => NewS): IModelType<PROPS, OTHERS, CustomC, NewS>;
89
- }
90
- /**
91
- * Any model type.
92
- */
93
- export interface IAnyModelType extends IModelType<any, any, any, any> {
94
- }
95
- /** @hidden */
96
- export declare type ExtractProps<T extends IAnyModelType> = T extends IModelType<infer P, any, any, any> ? P : never;
97
- /** @hidden */
98
- export declare type ExtractOthers<T extends IAnyModelType> = T extends IModelType<any, infer O, any, any> ? O : never;
99
- export declare function model<P extends ModelPropertiesDeclaration = {}>(name: string, properties?: P): IModelType<ModelPropertiesDeclarationToProperties<P>, {}>;
100
- export declare function model<P extends ModelPropertiesDeclaration = {}>(properties?: P): IModelType<ModelPropertiesDeclarationToProperties<P>, {}>;
101
- /** @hidden */
102
- export declare type _CustomJoin<A, B> = A extends _NotCustomized ? B : A & B;
103
- export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB>(name: string, A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>): IModelType<PA & PB, OA & OB, _CustomJoin<FCA, FCB>, _CustomJoin<FSA, FSB>>;
104
- export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB>(A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>): IModelType<PA & PB, OA & OB, _CustomJoin<FCA, FCB>, _CustomJoin<FSA, FSB>>;
105
- export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC>(name: string, A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>): IModelType<PA & PB & PC, OA & OB & OC, _CustomJoin<FCA, _CustomJoin<FCB, FCC>>, _CustomJoin<FSA, _CustomJoin<FSB, FSC>>>;
106
- export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC>(A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>): IModelType<PA & PB & PC, OA & OB & OC, _CustomJoin<FCA, _CustomJoin<FCB, FCC>>, _CustomJoin<FSA, _CustomJoin<FSB, FSC>>>;
107
- export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD>(name: string, A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>): IModelType<PA & PB & PC & PD, OA & OB & OC & OD, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, FCD>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, FSD>>>>;
108
- export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD>(A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>): IModelType<PA & PB & PC & PD, OA & OB & OC & OD, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, FCD>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, FSD>>>>;
109
- export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE>(name: string, A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>): IModelType<PA & PB & PC & PD & PE, OA & OB & OC & OD & OE, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, FCE>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, FSE>>>>>;
110
- export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE>(A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>): IModelType<PA & PB & PC & PD & PE, OA & OB & OC & OD & OE, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, FCE>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, FSE>>>>>;
111
- export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE, PF extends ModelProperties, OF, FCF, FSF>(name: string, A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>, F: IModelType<PF, OF, FCF, FSF>): IModelType<PA & PB & PC & PD & PE & PF, OA & OB & OC & OD & OE & OF, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, _CustomJoin<FCE, FCF>>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, _CustomJoin<FSE, FSF>>>>>>;
112
- export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE, PF extends ModelProperties, OF, FCF, FSF>(A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>, F: IModelType<PF, OF, FCF, FSF>): IModelType<PA & PB & PC & PD & PE & PF, OA & OB & OC & OD & OE & OF, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, _CustomJoin<FCE, FCF>>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, _CustomJoin<FSE, FSF>>>>>>;
113
- export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE, PF extends ModelProperties, OF, FCF, FSF, PG extends ModelProperties, OG, FCG, FSG>(name: string, A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>, F: IModelType<PF, OF, FCF, FSF>, G: IModelType<PG, OG, FCG, FSG>): IModelType<PA & PB & PC & PD & PE & PF & PG, OA & OB & OC & OD & OE & OF & OG, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, _CustomJoin<FCE, _CustomJoin<FCF, FCG>>>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, _CustomJoin<FSE, _CustomJoin<FSF, FSG>>>>>>>;
114
- export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE, PF extends ModelProperties, OF, FCF, FSF, PG extends ModelProperties, OG, FCG, FSG>(A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>, F: IModelType<PF, OF, FCF, FSF>, G: IModelType<PG, OG, FCG, FSG>): IModelType<PA & PB & PC & PD & PE & PF & PG, OA & OB & OC & OD & OE & OF & OG, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, _CustomJoin<FCE, _CustomJoin<FCF, FCG>>>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, _CustomJoin<FSE, _CustomJoin<FSF, FSG>>>>>>>;
115
- export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE, PF extends ModelProperties, OF, FCF, FSF, PG extends ModelProperties, OG, FCG, FSG, PH extends ModelProperties, OH, FCH, FSH>(name: string, A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>, F: IModelType<PF, OF, FCF, FSF>, G: IModelType<PG, OG, FCG, FSG>, H: IModelType<PH, OH, FCH, FSH>): IModelType<PA & PB & PC & PD & PE & PF & PG & PH, OA & OB & OC & OD & OE & OF & OG & OH, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, _CustomJoin<FCE, _CustomJoin<FCF, _CustomJoin<FCG, FCH>>>>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, _CustomJoin<FSE, _CustomJoin<FSF, _CustomJoin<FSG, FSH>>>>>>>>;
116
- export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE, PF extends ModelProperties, OF, FCF, FSF, PG extends ModelProperties, OG, FCG, FSG, PH extends ModelProperties, OH, FCH, FSH>(A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>, F: IModelType<PF, OF, FCF, FSF>, G: IModelType<PG, OG, FCG, FSG>, H: IModelType<PH, OH, FCH, FSH>): IModelType<PA & PB & PC & PD & PE & PF & PG & PH, OA & OB & OC & OD & OE & OF & OG & OH, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, _CustomJoin<FCE, _CustomJoin<FCF, _CustomJoin<FCG, FCH>>>>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, _CustomJoin<FSE, _CustomJoin<FSF, _CustomJoin<FSG, FSH>>>>>>>>;
117
- export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE, PF extends ModelProperties, OF, FCF, FSF, PG extends ModelProperties, OG, FCG, FSG, PH extends ModelProperties, OH, FCH, FSH, PI extends ModelProperties, OI, FCI, FSI>(name: string, A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>, F: IModelType<PF, OF, FCF, FSF>, G: IModelType<PG, OG, FCG, FSG>, H: IModelType<PH, OH, FCH, FSH>, I: IModelType<PI, OI, FCI, FSI>): IModelType<PA & PB & PC & PD & PE & PF & PG & PH & PI, OA & OB & OC & OD & OE & OF & OG & OH & OI, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, _CustomJoin<FCE, _CustomJoin<FCF, _CustomJoin<FCG, _CustomJoin<FCH, FCI>>>>>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, _CustomJoin<FSE, _CustomJoin<FSF, _CustomJoin<FSG, _CustomJoin<FSH, FSI>>>>>>>>>;
118
- export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE, PF extends ModelProperties, OF, FCF, FSF, PG extends ModelProperties, OG, FCG, FSG, PH extends ModelProperties, OH, FCH, FSH, PI extends ModelProperties, OI, FCI, FSI>(A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>, F: IModelType<PF, OF, FCF, FSF>, G: IModelType<PG, OG, FCG, FSG>, H: IModelType<PH, OH, FCH, FSH>, I: IModelType<PI, OI, FCI, FSI>): IModelType<PA & PB & PC & PD & PE & PF & PG & PH & PI, OA & OB & OC & OD & OE & OF & OG & OH & OI, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, _CustomJoin<FCE, _CustomJoin<FCF, _CustomJoin<FCG, _CustomJoin<FCH, FCI>>>>>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, _CustomJoin<FSE, _CustomJoin<FSF, _CustomJoin<FSG, _CustomJoin<FSH, FSI>>>>>>>>>;
119
- /**
120
- * Returns if a given value represents a model type.
121
- *
122
- * @param type
123
- * @returns
124
- */
125
- export declare function isModelType<IT extends IAnyModelType = IAnyModelType>(type: IAnyType): type is IT;
1
+ import { IAnyType, IType, _CustomOrOther, _NotCustomized, Instance } from "../../internal";
2
+ /** @hidden */
3
+ export interface ModelProperties {
4
+ [key: string]: IAnyType;
5
+ }
6
+ /** @hidden */
7
+ export declare type ModelPrimitive = string | number | boolean | Date;
8
+ /** @hidden */
9
+ export interface ModelPropertiesDeclaration {
10
+ [key: string]: ModelPrimitive | IAnyType;
11
+ }
12
+ /**
13
+ * Unmaps syntax property declarations to a map of { propName: IType }
14
+ *
15
+ * @hidden
16
+ */
17
+ export declare type ModelPropertiesDeclarationToProperties<T extends ModelPropertiesDeclaration> = T extends {
18
+ [k: string]: IAnyType;
19
+ } ? T : {
20
+ [K in keyof T]: T[K] extends IAnyType ? T[K] : T[K] extends string ? IType<string | undefined, string, string> : T[K] extends number ? IType<number | undefined, number, number> : T[K] extends boolean ? IType<boolean | undefined, boolean, boolean> : T[K] extends Date ? IType<number | Date | undefined, number, Date> : never;
21
+ };
22
+ /**
23
+ * Checks if a value is optional (undefined, any or unknown).
24
+ * @hidden
25
+ *
26
+ * Examples:
27
+ * - string = false
28
+ * - undefined = true
29
+ * - string | undefined = true
30
+ * - string & undefined = false, but we don't care
31
+ * - any = true
32
+ * - unknown = true
33
+ */
34
+ declare type IsOptionalValue<C, TV, FV> = undefined extends C ? TV : FV;
35
+ /**
36
+ * Name of the properties of an object that can't be set to undefined, any or unknown
37
+ * @hidden
38
+ */
39
+ declare type DefinablePropsNames<T> = {
40
+ [K in keyof T]: IsOptionalValue<T[K], never, K>;
41
+ }[keyof T];
42
+ /** @hidden */
43
+ export declare const $nonEmptyObject: unique symbol;
44
+ /** @hidden */
45
+ export interface NonEmptyObject {
46
+ [$nonEmptyObject]?: any;
47
+ }
48
+ /** @hidden */
49
+ export declare type ExtractCFromProps<P extends ModelProperties> = {
50
+ [k in keyof P]: P[k]["CreationType"];
51
+ };
52
+ /** @hidden */
53
+ export declare type ModelCreationType<PC> = {
54
+ [P in DefinablePropsNames<PC>]: PC[P];
55
+ } & Partial<PC> & NonEmptyObject;
56
+ /** @hidden */
57
+ export declare type ModelCreationType2<P extends ModelProperties, CustomC> = _CustomOrOther<CustomC, ModelCreationType<ExtractCFromProps<P>>>;
58
+ /** @hidden */
59
+ export declare type ModelSnapshotType<P extends ModelProperties> = {
60
+ [K in keyof P]: P[K]["SnapshotType"];
61
+ } & NonEmptyObject;
62
+ /** @hidden */
63
+ export declare type ModelSnapshotType2<P extends ModelProperties, CustomS> = _CustomOrOther<CustomS, ModelSnapshotType<P>>;
64
+ /**
65
+ * @hidden
66
+ * we keep this separate from ModelInstanceType to shorten model instance types generated declarations
67
+ */
68
+ export declare type ModelInstanceTypeProps<P extends ModelProperties> = {
69
+ [K in keyof P]: P[K]["Type"];
70
+ } & NonEmptyObject;
71
+ /**
72
+ * @hidden
73
+ * do not transform this to an interface or model instance type generated declarations will be longer
74
+ */
75
+ export declare type ModelInstanceType<P extends ModelProperties, O> = ModelInstanceTypeProps<P> & O;
76
+ /** @hidden */
77
+ export interface ModelActions {
78
+ [key: string]: Function;
79
+ }
80
+ export interface IModelType<PROPS extends ModelProperties, OTHERS, CustomC = _NotCustomized, CustomS = _NotCustomized> extends IType<ModelCreationType2<PROPS, CustomC>, ModelSnapshotType2<PROPS, CustomS>, ModelInstanceType<PROPS, OTHERS>> {
81
+ readonly properties: PROPS;
82
+ named(newName: string): IModelType<PROPS, OTHERS, CustomC, CustomS>;
83
+ props<PROPS2 extends ModelPropertiesDeclaration>(props: PROPS2): IModelType<PROPS & ModelPropertiesDeclarationToProperties<PROPS2>, OTHERS, CustomC, CustomS>;
84
+ views<V extends Object>(fn: (self: Instance<this>) => V): IModelType<PROPS, OTHERS & V, CustomC, CustomS>;
85
+ actions<A extends ModelActions>(fn: (self: Instance<this>) => A): IModelType<PROPS, OTHERS & A, CustomC, CustomS>;
86
+ volatile<TP extends object>(fn: (self: Instance<this>) => TP): IModelType<PROPS, OTHERS & TP, CustomC, CustomS>;
87
+ extend<A extends ModelActions = {}, V extends Object = {}, VS extends Object = {}>(fn: (self: Instance<this>) => {
88
+ actions?: A;
89
+ views?: V;
90
+ state?: VS;
91
+ }): IModelType<PROPS, OTHERS & A & V & VS, CustomC, CustomS>;
92
+ /** @deprecated See `types.snapshotProcessor` */
93
+ preProcessSnapshot<NewC = ModelCreationType2<PROPS, CustomC>>(fn: (snapshot: NewC) => ModelCreationType2<PROPS, CustomC>): IModelType<PROPS, OTHERS, NewC, CustomS>;
94
+ /** @deprecated See `types.snapshotProcessor` */
95
+ postProcessSnapshot<NewS = ModelSnapshotType2<PROPS, CustomS>>(fn: (snapshot: ModelSnapshotType2<PROPS, CustomS>) => NewS): IModelType<PROPS, OTHERS, CustomC, NewS>;
96
+ }
97
+ /**
98
+ * Any model type.
99
+ */
100
+ export interface IAnyModelType extends IModelType<any, any, any, any> {
101
+ }
102
+ /** @hidden */
103
+ export declare type ExtractProps<T extends IAnyModelType> = T extends IModelType<infer P, any, any, any> ? P : never;
104
+ /** @hidden */
105
+ export declare type ExtractOthers<T extends IAnyModelType> = T extends IModelType<any, infer O, any, any> ? O : never;
106
+ export declare function model<P extends ModelPropertiesDeclaration = {}>(name: string, properties?: P): IModelType<ModelPropertiesDeclarationToProperties<P>, {}>;
107
+ export declare function model<P extends ModelPropertiesDeclaration = {}>(properties?: P): IModelType<ModelPropertiesDeclarationToProperties<P>, {}>;
108
+ /** @hidden */
109
+ export declare type _CustomJoin<A, B> = A extends _NotCustomized ? B : A & B;
110
+ export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB>(name: string, A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>): IModelType<PA & PB, OA & OB, _CustomJoin<FCA, FCB>, _CustomJoin<FSA, FSB>>;
111
+ export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB>(A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>): IModelType<PA & PB, OA & OB, _CustomJoin<FCA, FCB>, _CustomJoin<FSA, FSB>>;
112
+ export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC>(name: string, A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>): IModelType<PA & PB & PC, OA & OB & OC, _CustomJoin<FCA, _CustomJoin<FCB, FCC>>, _CustomJoin<FSA, _CustomJoin<FSB, FSC>>>;
113
+ export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC>(A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>): IModelType<PA & PB & PC, OA & OB & OC, _CustomJoin<FCA, _CustomJoin<FCB, FCC>>, _CustomJoin<FSA, _CustomJoin<FSB, FSC>>>;
114
+ export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD>(name: string, A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>): IModelType<PA & PB & PC & PD, OA & OB & OC & OD, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, FCD>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, FSD>>>>;
115
+ export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD>(A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>): IModelType<PA & PB & PC & PD, OA & OB & OC & OD, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, FCD>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, FSD>>>>;
116
+ export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE>(name: string, A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>): IModelType<PA & PB & PC & PD & PE, OA & OB & OC & OD & OE, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, FCE>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, FSE>>>>>;
117
+ export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE>(A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>): IModelType<PA & PB & PC & PD & PE, OA & OB & OC & OD & OE, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, FCE>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, FSE>>>>>;
118
+ export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE, PF extends ModelProperties, OF, FCF, FSF>(name: string, A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>, F: IModelType<PF, OF, FCF, FSF>): IModelType<PA & PB & PC & PD & PE & PF, OA & OB & OC & OD & OE & OF, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, _CustomJoin<FCE, FCF>>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, _CustomJoin<FSE, FSF>>>>>>;
119
+ export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE, PF extends ModelProperties, OF, FCF, FSF>(A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>, F: IModelType<PF, OF, FCF, FSF>): IModelType<PA & PB & PC & PD & PE & PF, OA & OB & OC & OD & OE & OF, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, _CustomJoin<FCE, FCF>>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, _CustomJoin<FSE, FSF>>>>>>;
120
+ export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE, PF extends ModelProperties, OF, FCF, FSF, PG extends ModelProperties, OG, FCG, FSG>(name: string, A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>, F: IModelType<PF, OF, FCF, FSF>, G: IModelType<PG, OG, FCG, FSG>): IModelType<PA & PB & PC & PD & PE & PF & PG, OA & OB & OC & OD & OE & OF & OG, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, _CustomJoin<FCE, _CustomJoin<FCF, FCG>>>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, _CustomJoin<FSE, _CustomJoin<FSF, FSG>>>>>>>;
121
+ export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE, PF extends ModelProperties, OF, FCF, FSF, PG extends ModelProperties, OG, FCG, FSG>(A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>, F: IModelType<PF, OF, FCF, FSF>, G: IModelType<PG, OG, FCG, FSG>): IModelType<PA & PB & PC & PD & PE & PF & PG, OA & OB & OC & OD & OE & OF & OG, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, _CustomJoin<FCE, _CustomJoin<FCF, FCG>>>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, _CustomJoin<FSE, _CustomJoin<FSF, FSG>>>>>>>;
122
+ export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE, PF extends ModelProperties, OF, FCF, FSF, PG extends ModelProperties, OG, FCG, FSG, PH extends ModelProperties, OH, FCH, FSH>(name: string, A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>, F: IModelType<PF, OF, FCF, FSF>, G: IModelType<PG, OG, FCG, FSG>, H: IModelType<PH, OH, FCH, FSH>): IModelType<PA & PB & PC & PD & PE & PF & PG & PH, OA & OB & OC & OD & OE & OF & OG & OH, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, _CustomJoin<FCE, _CustomJoin<FCF, _CustomJoin<FCG, FCH>>>>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, _CustomJoin<FSE, _CustomJoin<FSF, _CustomJoin<FSG, FSH>>>>>>>>;
123
+ export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE, PF extends ModelProperties, OF, FCF, FSF, PG extends ModelProperties, OG, FCG, FSG, PH extends ModelProperties, OH, FCH, FSH>(A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>, F: IModelType<PF, OF, FCF, FSF>, G: IModelType<PG, OG, FCG, FSG>, H: IModelType<PH, OH, FCH, FSH>): IModelType<PA & PB & PC & PD & PE & PF & PG & PH, OA & OB & OC & OD & OE & OF & OG & OH, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, _CustomJoin<FCE, _CustomJoin<FCF, _CustomJoin<FCG, FCH>>>>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, _CustomJoin<FSE, _CustomJoin<FSF, _CustomJoin<FSG, FSH>>>>>>>>;
124
+ export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE, PF extends ModelProperties, OF, FCF, FSF, PG extends ModelProperties, OG, FCG, FSG, PH extends ModelProperties, OH, FCH, FSH, PI extends ModelProperties, OI, FCI, FSI>(name: string, A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>, F: IModelType<PF, OF, FCF, FSF>, G: IModelType<PG, OG, FCG, FSG>, H: IModelType<PH, OH, FCH, FSH>, I: IModelType<PI, OI, FCI, FSI>): IModelType<PA & PB & PC & PD & PE & PF & PG & PH & PI, OA & OB & OC & OD & OE & OF & OG & OH & OI, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, _CustomJoin<FCE, _CustomJoin<FCF, _CustomJoin<FCG, _CustomJoin<FCH, FCI>>>>>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, _CustomJoin<FSE, _CustomJoin<FSF, _CustomJoin<FSG, _CustomJoin<FSH, FSI>>>>>>>>>;
125
+ export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE, PF extends ModelProperties, OF, FCF, FSF, PG extends ModelProperties, OG, FCG, FSG, PH extends ModelProperties, OH, FCH, FSH, PI extends ModelProperties, OI, FCI, FSI>(A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>, F: IModelType<PF, OF, FCF, FSF>, G: IModelType<PG, OG, FCG, FSG>, H: IModelType<PH, OH, FCH, FSH>, I: IModelType<PI, OI, FCI, FSI>): IModelType<PA & PB & PC & PD & PE & PF & PG & PH & PI, OA & OB & OC & OD & OE & OF & OG & OH & OI, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, _CustomJoin<FCE, _CustomJoin<FCF, _CustomJoin<FCG, _CustomJoin<FCH, FCI>>>>>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, _CustomJoin<FSE, _CustomJoin<FSF, _CustomJoin<FSG, _CustomJoin<FSH, FSI>>>>>>>>>;
126
+ /**
127
+ * Returns if a given value represents a model type.
128
+ *
129
+ * @param type
130
+ * @returns
131
+ */
132
+ export declare function isModelType<IT extends IAnyModelType = IAnyModelType>(type: IAnyType): type is IT;
133
+ export {};
@@ -1,29 +1,29 @@
1
- import { enumeration, model, compose, custom, reference, safeReference, union, optional, literal, maybe, maybeNull, refinement, map, array, frozen, late, snapshotProcessor } from "../internal";
2
- export declare const types: {
3
- enumeration: typeof enumeration;
4
- model: typeof model;
5
- compose: typeof compose;
6
- custom: typeof custom;
7
- reference: typeof reference;
8
- safeReference: typeof safeReference;
9
- union: typeof union;
10
- optional: typeof optional;
11
- literal: typeof literal;
12
- maybe: typeof maybe;
13
- maybeNull: typeof maybeNull;
14
- refinement: typeof refinement;
15
- string: import("../internal").ISimpleType<string>;
16
- boolean: import("../internal").ISimpleType<boolean>;
17
- number: import("../internal").ISimpleType<number>;
18
- integer: import("../internal").ISimpleType<number>;
19
- Date: import("../internal").IType<number | Date, number, Date>;
20
- map: typeof map;
21
- array: typeof array;
22
- frozen: typeof frozen;
23
- identifier: import("../internal").ISimpleType<string>;
24
- identifierNumber: import("../internal").ISimpleType<number>;
25
- late: typeof late;
26
- undefined: import("../internal").ISimpleType<undefined>;
27
- null: import("../internal").ISimpleType<null>;
28
- snapshotProcessor: typeof snapshotProcessor;
29
- };
1
+ import { enumeration, model, compose, custom, reference, safeReference, union, optional, literal, maybe, maybeNull, refinement, map, array, frozen, late, snapshotProcessor } from "../internal";
2
+ export declare const types: {
3
+ enumeration: typeof enumeration;
4
+ model: typeof model;
5
+ compose: typeof compose;
6
+ custom: typeof custom;
7
+ reference: typeof reference;
8
+ safeReference: typeof safeReference;
9
+ union: typeof union;
10
+ optional: typeof optional;
11
+ literal: typeof literal;
12
+ maybe: typeof maybe;
13
+ maybeNull: typeof maybeNull;
14
+ refinement: typeof refinement;
15
+ string: import("../internal").ISimpleType<string>;
16
+ boolean: import("../internal").ISimpleType<boolean>;
17
+ number: import("../internal").ISimpleType<number>;
18
+ integer: import("../internal").ISimpleType<number>;
19
+ Date: import("../internal").IType<number | Date, number, Date>;
20
+ map: typeof map;
21
+ array: typeof array;
22
+ frozen: typeof frozen;
23
+ identifier: import("../internal").ISimpleType<string>;
24
+ identifierNumber: import("../internal").ISimpleType<number>;
25
+ late: typeof late;
26
+ undefined: import("../internal").ISimpleType<undefined>;
27
+ null: import("../internal").ISimpleType<null>;
28
+ snapshotProcessor: typeof snapshotProcessor;
29
+ };