mobx-state-tree 6.0.0 → 6.0.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.
- package/dist/mobx-state-tree.js +3 -3
- package/dist/mobx-state-tree.min.js +1 -1
- package/dist/mobx-state-tree.module.js +3 -3
- package/dist/mobx-state-tree.umd.js +3 -3
- package/dist/mobx-state-tree.umd.min.js +1 -1
- package/dist/types/complex-types/array.d.ts +1 -1
- package/dist/types/complex-types/map.d.ts +1 -1
- package/dist/types/complex-types/model.d.ts +14 -8
- package/dist/types/primitives.d.ts +1 -1
- package/dist/types/utility-types/frozen.d.ts +2 -2
- package/dist/types/utility-types/identifier.d.ts +1 -1
- package/dist/types/utility-types/late.d.ts +1 -1
- package/dist/types/utility-types/literal.d.ts +1 -1
- package/dist/types/utility-types/optional.d.ts +1 -1
- package/dist/types/utility-types/reference.d.ts +1 -1
- package/dist/types/utility-types/refinement.d.ts +1 -1
- package/dist/types/utility-types/union.d.ts +2 -3
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IAnyType, IType, _CustomOrOther, _NotCustomized, Instance, FunctionWithFlag
|
|
1
|
+
import { IAnyType, IType, _CustomOrOther, _NotCustomized, Instance, FunctionWithFlag } from "../../internal";
|
|
2
2
|
/** @hidden */
|
|
3
3
|
export interface ModelProperties {
|
|
4
4
|
[key: string]: IAnyType;
|
|
@@ -40,16 +40,22 @@ type DefinablePropsNames<T> = {
|
|
|
40
40
|
[K in keyof T]: IsOptionalValue<T[K], never, K>;
|
|
41
41
|
}[keyof T];
|
|
42
42
|
/** @hidden */
|
|
43
|
-
export type ExtractCFromProps<P extends ModelProperties> = {
|
|
43
|
+
export type ExtractCFromProps<P extends ModelProperties> = MaybeEmpty<{
|
|
44
44
|
[k in keyof P]: P[k]["CreationType"];
|
|
45
|
-
}
|
|
45
|
+
}>;
|
|
46
|
+
/** @hidden */
|
|
47
|
+
export type MaybeEmpty<T> = keyof T extends never ? EmptyObject : T;
|
|
46
48
|
/** @hidden */
|
|
47
|
-
export type ModelCreationType<PC> = {
|
|
49
|
+
export type ModelCreationType<PC> = MaybeEmpty<{
|
|
48
50
|
[P in DefinablePropsNames<PC>]: PC[P];
|
|
49
|
-
} & Partial<PC>;
|
|
50
|
-
type WithAdditionalProperties<T> = T extends Record<string, never> ?
|
|
51
|
+
}> & Partial<PC>;
|
|
52
|
+
type WithAdditionalProperties<T> = T extends Record<string, never> ? EmptyObject : T;
|
|
53
|
+
declare const $nonEmptyObject: unique symbol;
|
|
54
|
+
type EmptyObject = {
|
|
55
|
+
[$nonEmptyObject]?: never;
|
|
56
|
+
};
|
|
51
57
|
/** @hidden */
|
|
52
|
-
export type ModelCreationType2<P extends ModelProperties, CustomC> = keyof P extends never ?
|
|
58
|
+
export type ModelCreationType2<P extends ModelProperties, CustomC> = MaybeEmpty<keyof P extends never ? _CustomOrOther<CustomC, ModelCreationType<EmptyObject>> : _CustomOrOther<CustomC, ModelCreationType<ExtractCFromProps<P>>>>;
|
|
53
59
|
/** @hidden */
|
|
54
60
|
export type ModelSnapshotType<P extends ModelProperties> = {
|
|
55
61
|
[K in keyof P]: P[K]["SnapshotType"];
|
|
@@ -122,5 +128,5 @@ export declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB ext
|
|
|
122
128
|
* @param type
|
|
123
129
|
* @returns
|
|
124
130
|
*/
|
|
125
|
-
export declare function isModelType
|
|
131
|
+
export declare function isModelType(type: unknown): type is IAnyModelType;
|
|
126
132
|
export {};
|
|
@@ -101,4 +101,4 @@ export declare const DatePrimitive: IType<number | Date, number, Date>;
|
|
|
101
101
|
* @param type
|
|
102
102
|
* @returns
|
|
103
103
|
*/
|
|
104
|
-
export declare function isPrimitiveType
|
|
104
|
+
export declare function isPrimitiveType(type: unknown): type is ISimpleType<string> | ISimpleType<number> | ISimpleType<boolean> | typeof DatePrimitive;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IType } from "../../internal";
|
|
1
|
+
import { IType, type ISimpleType } from "../../internal";
|
|
2
2
|
export declare function frozen<C>(subType: IType<C, any, any>): IType<C, C, C>;
|
|
3
3
|
export declare function frozen<T>(defaultValue: T): IType<T | undefined | null, T, T>;
|
|
4
4
|
export declare function frozen<T = any>(): IType<T, T, T>;
|
|
@@ -8,4 +8,4 @@ export declare function frozen<T = any>(): IType<T, T, T>;
|
|
|
8
8
|
* @param type
|
|
9
9
|
* @returns
|
|
10
10
|
*/
|
|
11
|
-
export declare function isFrozenType
|
|
11
|
+
export declare function isFrozenType(type: unknown): type is ISimpleType<any>;
|
|
@@ -37,7 +37,7 @@ export declare const identifierNumber: ISimpleType<number>;
|
|
|
37
37
|
* @param type
|
|
38
38
|
* @returns
|
|
39
39
|
*/
|
|
40
|
-
export declare function isIdentifierType
|
|
40
|
+
export declare function isIdentifierType(type: unknown): type is typeof identifier | typeof identifierNumber;
|
|
41
41
|
/**
|
|
42
42
|
* Valid types for identifiers.
|
|
43
43
|
*/
|
|
@@ -22,4 +22,4 @@ export declare function literal<S extends Primitives>(value: S): ISimpleType<S>;
|
|
|
22
22
|
* @param type
|
|
23
23
|
* @returns
|
|
24
24
|
*/
|
|
25
|
-
export declare function isLiteralType
|
|
25
|
+
export declare function isLiteralType(type: unknown): type is ISimpleType<any>;
|
|
@@ -17,4 +17,4 @@ export declare function optional<IT extends IAnyType, OptionalVals extends Valid
|
|
|
17
17
|
* @param type
|
|
18
18
|
* @returns
|
|
19
19
|
*/
|
|
20
|
-
export declare function isOptionalType
|
|
20
|
+
export declare function isOptionalType(type: unknown): type is IOptionalIType<IAnyType, [any, ...any[]]>;
|
|
@@ -32,7 +32,7 @@ export declare function reference<IT extends IAnyComplexType>(subType: IT, optio
|
|
|
32
32
|
* @param type
|
|
33
33
|
* @returns
|
|
34
34
|
*/
|
|
35
|
-
export declare function isReferenceType
|
|
35
|
+
export declare function isReferenceType(type: unknown): type is IReferenceType<IAnyComplexType>;
|
|
36
36
|
export declare function safeReference<IT extends IAnyComplexType>(subType: IT, options: (ReferenceOptionsGetSet<IT> | {}) & {
|
|
37
37
|
acceptsUndefined: false;
|
|
38
38
|
onInvalidated?: OnReferenceInvalidated<ReferenceT<IT>>;
|
|
@@ -7,4 +7,4 @@ export declare function refinement<IT extends IAnyType>(type: IT, predicate: (sn
|
|
|
7
7
|
* @param type
|
|
8
8
|
* @returns
|
|
9
9
|
*/
|
|
10
|
-
export declare function isRefinementType
|
|
10
|
+
export declare function isRefinementType(type: unknown): type is IAnyType;
|
|
@@ -12,7 +12,7 @@ export type _CustomCSProcessor<T> = Exclude<T, _NotCustomized> extends never ? _
|
|
|
12
12
|
/** @hidden */
|
|
13
13
|
export interface ITypeUnion<C, S, T> extends IType<_CustomCSProcessor<C>, _CustomCSProcessor<S>, T> {
|
|
14
14
|
}
|
|
15
|
-
type IUnionType<Types extends IAnyType[]> = ITypeUnion<Types[number]["CreationType"], Types[number]["SnapshotType"], Types[number]["TypeWithoutSTN"]>;
|
|
15
|
+
export type IUnionType<Types extends IAnyType[]> = ITypeUnion<Types[number]["CreationType"], Types[number]["SnapshotType"], Types[number]["TypeWithoutSTN"]>;
|
|
16
16
|
export declare function union<Types extends IAnyType[]>(...types: Types): IUnionType<Types>;
|
|
17
17
|
export declare function union<Types extends IAnyType[]>(options: UnionOptions, ...types: Types): IUnionType<Types>;
|
|
18
18
|
/**
|
|
@@ -21,5 +21,4 @@ export declare function union<Types extends IAnyType[]>(options: UnionOptions, .
|
|
|
21
21
|
* @param type
|
|
22
22
|
* @returns
|
|
23
23
|
*/
|
|
24
|
-
export declare function isUnionType
|
|
25
|
-
export {};
|
|
24
|
+
export declare function isUnionType(type: unknown): type is IUnionType<IAnyType[]>;
|