mobx-state-tree 6.0.1-pre.1 → 7.0.0-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.
- package/dist/mobx-state-tree.js +20 -3
- package/dist/mobx-state-tree.min.js +1 -1
- package/dist/mobx-state-tree.module.js +20 -3
- package/dist/mobx-state-tree.umd.js +20 -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
package/dist/mobx-state-tree.js
CHANGED
|
@@ -4843,6 +4843,23 @@ var SnapshotProcessor = /** @class */ (function (_super) {
|
|
|
4843
4843
|
return this._subtype;
|
|
4844
4844
|
}
|
|
4845
4845
|
});
|
|
4846
|
+
/**
|
|
4847
|
+
* MST considers a given value to "be" of a subtype is the value is either:
|
|
4848
|
+
*
|
|
4849
|
+
* 1. And instance of the subtype
|
|
4850
|
+
* 2. A valid snapshot *in* of the subtype
|
|
4851
|
+
*
|
|
4852
|
+
* Before v7, we used to also consider processed models (as in, SnapshotOut values of this).
|
|
4853
|
+
* This is no longer the case, and is more in line with our overall "is" philosophy, which you can
|
|
4854
|
+
* see in `src/core/type/type.ts:104` (assuming lines don't change too much).
|
|
4855
|
+
*
|
|
4856
|
+
* For additonal commentary, see discussion in https://github.com/mobxjs/mobx-state-tree/pull/2182
|
|
4857
|
+
*
|
|
4858
|
+
* The `is` function specifically checks for `SnapshotIn` or `Instance` of a given type.
|
|
4859
|
+
*
|
|
4860
|
+
* @param thing
|
|
4861
|
+
* @returns
|
|
4862
|
+
*/
|
|
4846
4863
|
Object.defineProperty(SnapshotProcessor.prototype, "is", {
|
|
4847
4864
|
enumerable: false,
|
|
4848
4865
|
configurable: true,
|
|
@@ -6974,7 +6991,7 @@ function refinement() {
|
|
|
6974
6991
|
* @returns
|
|
6975
6992
|
*/
|
|
6976
6993
|
function isRefinementType(type) {
|
|
6977
|
-
return (type.flags & TypeFlags.Refinement) > 0;
|
|
6994
|
+
return isType(type) && (type.flags & TypeFlags.Refinement) > 0;
|
|
6978
6995
|
}
|
|
6979
6996
|
|
|
6980
6997
|
/**
|
|
@@ -7180,7 +7197,7 @@ function union(optionsOrType) {
|
|
|
7180
7197
|
* @returns
|
|
7181
7198
|
*/
|
|
7182
7199
|
function isUnionType(type) {
|
|
7183
|
-
return (type.flags & TypeFlags.Union) > 0;
|
|
7200
|
+
return isType(type) && (type.flags & TypeFlags.Union) > 0;
|
|
7184
7201
|
}
|
|
7185
7202
|
|
|
7186
7203
|
/**
|
|
@@ -8229,7 +8246,7 @@ function reference(subType, options) {
|
|
|
8229
8246
|
* @returns
|
|
8230
8247
|
*/
|
|
8231
8248
|
function isReferenceType(type) {
|
|
8232
|
-
return (type.flags & TypeFlags.Reference) > 0;
|
|
8249
|
+
return isType(type) && (type.flags & TypeFlags.Reference) > 0;
|
|
8233
8250
|
}
|
|
8234
8251
|
/**
|
|
8235
8252
|
* `types.safeReference` - A safe reference is like a standard reference, except that it accepts the undefined value by default
|