mobx-state-tree 5.4.0 → 5.4.2-pre.1

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.
@@ -1,5 +1,5 @@
1
1
  import { IDisposer, IAnyStateTreeNode, IActionContext } from "../internal";
2
- export declare type IMiddlewareEventType = "action" | "flow_spawn" | "flow_resume" | "flow_resume_error" | "flow_return" | "flow_throw";
2
+ export type IMiddlewareEventType = "action" | "flow_spawn" | "flow_resume" | "flow_resume_error" | "flow_return" | "flow_throw";
3
3
  export interface IMiddlewareEvent extends IActionContext {
4
4
  /** Event type */
5
5
  readonly type: IMiddlewareEventType;
@@ -16,7 +16,7 @@ export interface FunctionWithFlag extends Function {
16
16
  _isMSTAction?: boolean;
17
17
  _isFlowAction?: boolean;
18
18
  }
19
- export declare type IMiddlewareHandler = (actionCall: IMiddlewareEvent, next: (actionCall: IMiddlewareEvent, callback?: (value: any) => any) => void, abort: (value: any) => void) => any;
19
+ export type IMiddlewareHandler = (actionCall: IMiddlewareEvent, next: (actionCall: IMiddlewareEvent, callback?: (value: any) => any) => void, abort: (value: any) => void) => any;
20
20
  /**
21
21
  * Middleware can be used to intercept any action is invoked on the subtree where it is attached.
22
22
  * If a tree is protected (by default), this means that any mutation of the tree will pass through your middleware.
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @hidden
3
3
  */
4
- export declare type FlowReturn<R> = R extends Promise<infer T> ? T : R;
4
+ export type FlowReturn<R> = R extends Promise<infer T> ? T : R;
5
5
  /**
6
6
  * See [asynchronous actions](concepts/async-actions.md).
7
7
  *
@@ -1,6 +1,6 @@
1
1
  import { IAnyStateTreeNode, IType, IAnyModelType, IStateTreeNode, IJsonPatch, IDisposer, IAnyType, ReferenceIdentifier, TypeOfValue, IActionContext, IAnyComplexType } from "../internal";
2
2
  /** @hidden */
3
- export declare type TypeOrStateTreeNodeToStateTreeNode<T extends IAnyType | IAnyStateTreeNode> = T extends IType<any, any, infer TT> ? TT & IStateTreeNode<T> : T;
3
+ export type TypeOrStateTreeNodeToStateTreeNode<T extends IAnyType | IAnyStateTreeNode> = T extends IType<any, any, infer TT> ? TT & IStateTreeNode<T> : T;
4
4
  /**
5
5
  * Returns the _actual_ type of the given tree node. (Or throws)
6
6
  *
@@ -14,4 +14,4 @@ export interface IHooks {
14
14
  [Hook.beforeDetach]?: () => void;
15
15
  [Hook.beforeDestroy]?: () => void;
16
16
  }
17
- export declare type IHooksGetter<T> = (self: T) => IHooks;
17
+ export type IHooksGetter<T> = (self: T) => IHooks;
@@ -4,7 +4,7 @@
4
4
  * - `"error"`: Throw an exception.
5
5
  * - "`ignore`": Do nothing.
6
6
  */
7
- export declare type LivelinessMode = "warn" | "error" | "ignore";
7
+ export type LivelinessMode = "warn" | "error" | "ignore";
8
8
  /**
9
9
  * Defines what MST should do when running into reads / writes to objects that have died.
10
10
  * By default it will print a warning.
@@ -23,7 +23,7 @@ export declare function getLivelinessChecking(): LivelinessMode;
23
23
  * @deprecated use LivelinessMode instead
24
24
  * @hidden
25
25
  */
26
- export declare type LivelynessMode = LivelinessMode;
26
+ export type LivelynessMode = LivelinessMode;
27
27
  /**
28
28
  * @deprecated use setLivelinessChecking instead
29
29
  * @hidden
@@ -9,7 +9,7 @@ export interface IStateTreeNode<IT extends IAnyType = IAnyType> {
9
9
  readonly [$stateTreeNodeType]?: [IT] | [any];
10
10
  }
11
11
  /** @hidden */
12
- export declare type TypeOfValue<T extends IAnyStateTreeNode> = T extends IStateTreeNode<infer IT> ? IT : never;
12
+ export type TypeOfValue<T extends IAnyStateTreeNode> = T extends IStateTreeNode<infer IT> ? IT : never;
13
13
  /**
14
14
  * Represents any state tree node instance.
15
15
  * @hidden
@@ -7,7 +7,7 @@ export interface IValidationContextEntry {
7
7
  type: IAnyType;
8
8
  }
9
9
  /** Array of validation context entries */
10
- export declare type IValidationContext = IValidationContextEntry[];
10
+ export type IValidationContext = IValidationContextEntry[];
11
11
  /** Type validation error */
12
12
  export interface IValidationError {
13
13
  /** Validation context */
@@ -18,7 +18,7 @@ export interface IValidationError {
18
18
  message?: string;
19
19
  }
20
20
  /** Type validation result, which is an array of type validation errors */
21
- export declare type IValidationResult = IValidationError[];
21
+ export type IValidationResult = IValidationError[];
22
22
  /**
23
23
  * Run's the typechecker for the given type on the given value, which can be a snapshot or an instance.
24
24
  * Throws if the given value is not according the provided type specification.
@@ -3,7 +3,7 @@ import { IValidationContext, IValidationResult, IStateTreeNode, ModelPrimitive }
3
3
  * A state tree node value.
4
4
  * @hidden
5
5
  */
6
- export declare type STNValue<T, IT extends IAnyType> = T extends object ? T & IStateTreeNode<IT> : T;
6
+ export type STNValue<T, IT extends IAnyType> = T extends object ? T & IStateTreeNode<IT> : T;
7
7
  /** @hidden */
8
8
  declare const $type: unique symbol;
9
9
  /**
@@ -77,7 +77,7 @@ export interface IAnyType extends IType<any, any, any> {
77
77
  export interface ISimpleType<T> extends IType<T, T, T> {
78
78
  }
79
79
  /** @hidden */
80
- export declare type Primitives = ModelPrimitive | null | undefined;
80
+ export type Primitives = ModelPrimitive | null | undefined;
81
81
  /**
82
82
  * A complex type.
83
83
  * @deprecated just for compatibility with old versions, could be deprecated on the next major version
@@ -91,14 +91,14 @@ export interface IComplexType<C, S, T> extends IType<C, S, T & object> {
91
91
  export interface IAnyComplexType extends IType<any, any, object> {
92
92
  }
93
93
  /** @hidden */
94
- export declare type ExtractCSTWithoutSTN<IT extends {
94
+ export type ExtractCSTWithoutSTN<IT extends {
95
95
  [$type]: undefined;
96
96
  CreationType: any;
97
97
  SnapshotType: any;
98
98
  TypeWithoutSTN: any;
99
99
  }> = IT["CreationType"] | IT["SnapshotType"] | IT["TypeWithoutSTN"];
100
100
  /** @hidden */
101
- export declare type ExtractCSTWithSTN<IT extends {
101
+ export type ExtractCSTWithSTN<IT extends {
102
102
  [$type]: undefined;
103
103
  CreationType: any;
104
104
  SnapshotType: any;
@@ -107,21 +107,21 @@ export declare type ExtractCSTWithSTN<IT extends {
107
107
  /**
108
108
  * The instance representation of a given type.
109
109
  */
110
- export declare type Instance<T> = T extends {
110
+ export type Instance<T> = T extends {
111
111
  [$type]: undefined;
112
112
  Type: any;
113
113
  } ? T["Type"] : T;
114
114
  /**
115
115
  * The input (creation) snapshot representation of a given type.
116
116
  */
117
- export declare type SnapshotIn<T> = T extends {
117
+ export type SnapshotIn<T> = T extends {
118
118
  [$type]: undefined;
119
119
  CreationType: any;
120
120
  } ? T["CreationType"] : T extends IStateTreeNode<infer IT> ? IT["CreationType"] : T;
121
121
  /**
122
122
  * The output snapshot representation of a given type.
123
123
  */
124
- export declare type SnapshotOut<T> = T extends {
124
+ export type SnapshotOut<T> = T extends {
125
125
  [$type]: undefined;
126
126
  SnapshotType: any;
127
127
  } ? T["SnapshotType"] : T extends IStateTreeNode<infer IT> ? IT["SnapshotType"] : T;
@@ -151,7 +151,7 @@ export declare type SnapshotOut<T> = T extends {
151
151
  * }))
152
152
  * ```
153
153
  */
154
- export declare type SnapshotOrInstance<T> = SnapshotIn<T> | Instance<T>;
154
+ export type SnapshotOrInstance<T> = SnapshotIn<T> | Instance<T>;
155
155
  /**
156
156
  * Returns if a given value represents a type.
157
157
  *