mobx-state-tree 5.0.2 → 5.1.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.
@@ -64,11 +64,13 @@ PERFORMANCE OF THIS SOFTWARE.
64
64
  var extendStatics = function(d, b) {
65
65
  extendStatics = Object.setPrototypeOf ||
66
66
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
67
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
67
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
68
68
  return extendStatics(d, b);
69
69
  };
70
70
 
71
71
  function __extends(d, b) {
72
+ if (typeof b !== "function" && b !== null)
73
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
72
74
  extendStatics(d, b);
73
75
  function __() { this.constructor = d; }
74
76
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -154,6 +156,7 @@ function __read(o, n) {
154
156
  return ar;
155
157
  }
156
158
 
159
+ /** @deprecated */
157
160
  function __spread() {
158
161
  for (var ar = [], i = 0; i < arguments.length; i++)
159
162
  ar = ar.concat(__read(arguments[i]));
@@ -573,7 +576,7 @@ function resolveIdentifier(type, target, identifier) {
573
576
  assertIsStateTreeNode(target, 2);
574
577
  assertIsValidIdentifier(identifier, 3);
575
578
  var node = getStateTreeNode(target).root.identifierCache.resolve(type, normalizeIdentifier(identifier));
576
- return node ? node.value : undefined;
579
+ return node === null || node === void 0 ? void 0 : node.value;
577
580
  }
578
581
  /**
579
582
  * Returns the identifier of the target node.
@@ -1123,6 +1126,14 @@ var BaseNode = /** @class */ (function () {
1123
1126
  enumerable: false,
1124
1127
  configurable: true
1125
1128
  });
1129
+ Object.defineProperty(BaseNode.prototype, "getReconciliationType", {
1130
+ enumerable: false,
1131
+ configurable: true,
1132
+ writable: true,
1133
+ value: function () {
1134
+ return this.type;
1135
+ }
1136
+ });
1126
1137
  Object.defineProperty(BaseNode.prototype, "baseSetParent", {
1127
1138
  enumerable: false,
1128
1139
  configurable: true,
@@ -2461,6 +2472,16 @@ var ComplexType = /** @class */ (function (_super) {
2461
2472
  return node.storedValue;
2462
2473
  }
2463
2474
  });
2475
+ Object.defineProperty(ComplexType.prototype, "isMatchingSnapshotId", {
2476
+ enumerable: false,
2477
+ configurable: true,
2478
+ writable: true,
2479
+ value: function (current, snapshot) {
2480
+ return (!current.identifierAttribute ||
2481
+ current.identifier ===
2482
+ normalizeIdentifier(snapshot[current.identifierAttribute]));
2483
+ }
2484
+ });
2464
2485
  Object.defineProperty(ComplexType.prototype, "tryToReconcileNode", {
2465
2486
  enumerable: false,
2466
2487
  configurable: true,
@@ -2479,9 +2500,7 @@ var ComplexType = /** @class */ (function (_super) {
2479
2500
  if (current.type === this &&
2480
2501
  isMutable(newValue) &&
2481
2502
  !isStateTreeNode(newValue) &&
2482
- (!current.identifierAttribute ||
2483
- current.identifier ===
2484
- normalizeIdentifier(newValue[current.identifierAttribute]))) {
2503
+ this.isMatchingSnapshotId(current, newValue)) {
2485
2504
  // the newValue has no node, so can be treated like a snapshot
2486
2505
  // we can reconcile
2487
2506
  current.applySnapshot(newValue);
@@ -3907,14 +3926,12 @@ function isMutable(value) {
3907
3926
  */
3908
3927
  function isPrimitive(value, includeDate) {
3909
3928
  if (includeDate === void 0) { includeDate = true; }
3910
- if (value === null || value === undefined)
3911
- return true;
3912
- if (typeof value === "string" ||
3929
+ return (value === null ||
3930
+ value === undefined ||
3931
+ typeof value === "string" ||
3913
3932
  typeof value === "number" ||
3914
3933
  typeof value === "boolean" ||
3915
- (includeDate && value instanceof Date))
3916
- return true;
3917
- return false;
3934
+ (includeDate && value instanceof Date));
3918
3935
  }
3919
3936
  /**
3920
3937
  * @internal
@@ -4571,6 +4588,8 @@ function splitJsonPath(path) {
4571
4588
  return parts;
4572
4589
  }
4573
4590
 
4591
+ /** @hidden */
4592
+ var $preProcessorFailed = Symbol("$preProcessorFailed");
4574
4593
  var SnapshotProcessor = /** @class */ (function (_super) {
4575
4594
  __extends(SnapshotProcessor, _super);
4576
4595
  function SnapshotProcessor(_subtype, _processors, name) {
@@ -4615,6 +4634,19 @@ var SnapshotProcessor = /** @class */ (function (_super) {
4615
4634
  return sn;
4616
4635
  }
4617
4636
  });
4637
+ Object.defineProperty(SnapshotProcessor.prototype, "preProcessSnapshotSafe", {
4638
+ enumerable: false,
4639
+ configurable: true,
4640
+ writable: true,
4641
+ value: function (sn) {
4642
+ try {
4643
+ return this.preProcessSnapshot(sn);
4644
+ }
4645
+ catch (e) {
4646
+ return $preProcessorFailed;
4647
+ }
4648
+ }
4649
+ });
4618
4650
  Object.defineProperty(SnapshotProcessor.prototype, "postProcessSnapshot", {
4619
4651
  enumerable: false,
4620
4652
  configurable: true,
@@ -4638,6 +4670,9 @@ var SnapshotProcessor = /** @class */ (function (_super) {
4638
4670
  node.getSnapshot = function () {
4639
4671
  return _this.postProcessSnapshot(oldGetSnapshot.call(node));
4640
4672
  };
4673
+ node.getReconciliationType = function () {
4674
+ return _this;
4675
+ };
4641
4676
  }
4642
4677
  });
4643
4678
  Object.defineProperty(SnapshotProcessor.prototype, "instantiate", {
@@ -4680,7 +4715,10 @@ var SnapshotProcessor = /** @class */ (function (_super) {
4680
4715
  configurable: true,
4681
4716
  writable: true,
4682
4717
  value: function (value, context) {
4683
- var processedSn = this.preProcessSnapshot(value);
4718
+ var processedSn = this.preProcessSnapshotSafe(value);
4719
+ if (processedSn === $preProcessorFailed) {
4720
+ return typeCheckFailure(context, value, "Failed to preprocess value");
4721
+ }
4684
4722
  return this._subtype.validate(processedSn, context);
4685
4723
  }
4686
4724
  });
@@ -4701,7 +4739,10 @@ var SnapshotProcessor = /** @class */ (function (_super) {
4701
4739
  ? this._subtype
4702
4740
  : isStateTreeNode(thing)
4703
4741
  ? getSnapshot(thing, false)
4704
- : this.preProcessSnapshot(thing);
4742
+ : this.preProcessSnapshotSafe(thing);
4743
+ if (value === $preProcessorFailed) {
4744
+ return false;
4745
+ }
4705
4746
  return this._subtype.validate(value, [{ path: "", type: this._subtype }]).length === 0;
4706
4747
  }
4707
4748
  });
@@ -4713,6 +4754,18 @@ var SnapshotProcessor = /** @class */ (function (_super) {
4713
4754
  return this._subtype.isAssignableFrom(type);
4714
4755
  }
4715
4756
  });
4757
+ Object.defineProperty(SnapshotProcessor.prototype, "isMatchingSnapshotId", {
4758
+ enumerable: false,
4759
+ configurable: true,
4760
+ writable: true,
4761
+ value: function (current, snapshot) {
4762
+ if (!(this._subtype instanceof ComplexType)) {
4763
+ return false;
4764
+ }
4765
+ var processedSn = this.preProcessSnapshot(snapshot);
4766
+ return this._subtype.isMatchingSnapshotId(current, processedSn);
4767
+ }
4768
+ });
4716
4769
  return SnapshotProcessor;
4717
4770
  }(BaseType));
4718
4771
  function proxyNodeTypeMethods(nodeType, snapshotProcessorType) {
@@ -4974,18 +5027,17 @@ var MapType = /** @class */ (function (_super) {
4974
5027
  }
4975
5028
  var modelTypes = [];
4976
5029
  if (tryCollectModelTypes(this._subType, modelTypes)) {
4977
- var identifierAttribute_1 = undefined;
4978
- modelTypes.forEach(function (type) {
4979
- if (type.identifierAttribute) {
4980
- if (identifierAttribute_1 && identifierAttribute_1 !== type.identifierAttribute) {
4981
- throw fail$1("The objects in a map should all have the same identifier attribute, expected '" + identifierAttribute_1 + "', but child of type '" + type.name + "' declared attribute '" + type.identifierAttribute + "' as identifier");
4982
- }
4983
- identifierAttribute_1 = type.identifierAttribute;
5030
+ var identifierAttribute = modelTypes.reduce(function (current, type) {
5031
+ if (!type.identifierAttribute)
5032
+ return current;
5033
+ if (current && current !== type.identifierAttribute) {
5034
+ throw fail$1("The objects in a map should all have the same identifier attribute, expected '" + current + "', but child of type '" + type.name + "' declared attribute '" + type.identifierAttribute + "' as identifier");
4984
5035
  }
4985
- });
4986
- if (identifierAttribute_1) {
5036
+ return type.identifierAttribute;
5037
+ }, undefined);
5038
+ if (identifierAttribute) {
4987
5039
  this.identifierMode = MapIdentifierMode.YES;
4988
- this.mapIdentifierAttribute = identifierAttribute_1;
5040
+ this.mapIdentifierAttribute = identifierAttribute;
4989
5041
  }
4990
5042
  else {
4991
5043
  this.identifierMode = MapIdentifierMode.NO;
@@ -5704,13 +5756,17 @@ function areSame(oldNode, newValue) {
5704
5756
  if (oldNode.snapshot === newValue) {
5705
5757
  return true;
5706
5758
  }
5759
+ // Non object nodes don't get reconciled
5760
+ if (!(oldNode instanceof ObjectNode)) {
5761
+ return false;
5762
+ }
5763
+ var oldNodeType = oldNode.getReconciliationType();
5707
5764
  // new value is a snapshot with the correct identifier
5708
- return (oldNode instanceof ObjectNode &&
5709
- oldNode.identifier !== null &&
5765
+ return (oldNode.identifier !== null &&
5710
5766
  oldNode.identifierAttribute &&
5711
5767
  isPlainObject(newValue) &&
5712
- oldNode.identifier === normalizeIdentifier(newValue[oldNode.identifierAttribute]) &&
5713
- oldNode.type.is(newValue));
5768
+ oldNodeType.is(newValue) &&
5769
+ oldNodeType.isMatchingSnapshotId(oldNode, newValue));
5714
5770
  }
5715
5771
  /**
5716
5772
  * Returns if a given value represents an array type.
@@ -6864,7 +6920,7 @@ var Union = /** @class */ (function (_super) {
6864
6920
  configurable: true,
6865
6921
  writable: true,
6866
6922
  value: function (current, newValue, parent, subpath) {
6867
- var type = this.determineType(newValue, current.type);
6923
+ var type = this.determineType(newValue, current.getReconciliationType());
6868
6924
  if (!type)
6869
6925
  throw fail$1("No matching type for union " + this.describe()); // can happen in prod builds
6870
6926
  return type.reconcile(current, newValue, parent, subpath);
@@ -1,7 +1,7 @@
1
1
  (function (global, factory) {
2
2
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('mobx')) :
3
3
  typeof define === 'function' && define.amd ? define(['exports', 'mobx'], factory) :
4
- (global = global || self, factory(global.mobxStateTree = {}, global.mobx));
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.mobxStateTree = {}, global.mobx));
5
5
  }(this, (function (exports, mobx) { 'use strict';
6
6
 
7
7
  var livelinessChecking = "warn";
@@ -68,11 +68,13 @@
68
68
  var extendStatics = function(d, b) {
69
69
  extendStatics = Object.setPrototypeOf ||
70
70
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
71
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
71
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
72
72
  return extendStatics(d, b);
73
73
  };
74
74
 
75
75
  function __extends(d, b) {
76
+ if (typeof b !== "function" && b !== null)
77
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
76
78
  extendStatics(d, b);
77
79
  function __() { this.constructor = d; }
78
80
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -158,6 +160,7 @@
158
160
  return ar;
159
161
  }
160
162
 
163
+ /** @deprecated */
161
164
  function __spread() {
162
165
  for (var ar = [], i = 0; i < arguments.length; i++)
163
166
  ar = ar.concat(__read(arguments[i]));
@@ -577,7 +580,7 @@
577
580
  assertIsStateTreeNode(target, 2);
578
581
  assertIsValidIdentifier(identifier, 3);
579
582
  var node = getStateTreeNode(target).root.identifierCache.resolve(type, normalizeIdentifier(identifier));
580
- return node ? node.value : undefined;
583
+ return node === null || node === void 0 ? void 0 : node.value;
581
584
  }
582
585
  /**
583
586
  * Returns the identifier of the target node.
@@ -1127,6 +1130,14 @@
1127
1130
  enumerable: false,
1128
1131
  configurable: true
1129
1132
  });
1133
+ Object.defineProperty(BaseNode.prototype, "getReconciliationType", {
1134
+ enumerable: false,
1135
+ configurable: true,
1136
+ writable: true,
1137
+ value: function () {
1138
+ return this.type;
1139
+ }
1140
+ });
1130
1141
  Object.defineProperty(BaseNode.prototype, "baseSetParent", {
1131
1142
  enumerable: false,
1132
1143
  configurable: true,
@@ -2465,6 +2476,16 @@
2465
2476
  return node.storedValue;
2466
2477
  }
2467
2478
  });
2479
+ Object.defineProperty(ComplexType.prototype, "isMatchingSnapshotId", {
2480
+ enumerable: false,
2481
+ configurable: true,
2482
+ writable: true,
2483
+ value: function (current, snapshot) {
2484
+ return (!current.identifierAttribute ||
2485
+ current.identifier ===
2486
+ normalizeIdentifier(snapshot[current.identifierAttribute]));
2487
+ }
2488
+ });
2468
2489
  Object.defineProperty(ComplexType.prototype, "tryToReconcileNode", {
2469
2490
  enumerable: false,
2470
2491
  configurable: true,
@@ -2483,9 +2504,7 @@
2483
2504
  if (current.type === this &&
2484
2505
  isMutable(newValue) &&
2485
2506
  !isStateTreeNode(newValue) &&
2486
- (!current.identifierAttribute ||
2487
- current.identifier ===
2488
- normalizeIdentifier(newValue[current.identifierAttribute]))) {
2507
+ this.isMatchingSnapshotId(current, newValue)) {
2489
2508
  // the newValue has no node, so can be treated like a snapshot
2490
2509
  // we can reconcile
2491
2510
  current.applySnapshot(newValue);
@@ -3911,14 +3930,12 @@
3911
3930
  */
3912
3931
  function isPrimitive(value, includeDate) {
3913
3932
  if (includeDate === void 0) { includeDate = true; }
3914
- if (value === null || value === undefined)
3915
- return true;
3916
- if (typeof value === "string" ||
3933
+ return (value === null ||
3934
+ value === undefined ||
3935
+ typeof value === "string" ||
3917
3936
  typeof value === "number" ||
3918
3937
  typeof value === "boolean" ||
3919
- (includeDate && value instanceof Date))
3920
- return true;
3921
- return false;
3938
+ (includeDate && value instanceof Date));
3922
3939
  }
3923
3940
  /**
3924
3941
  * @internal
@@ -4553,6 +4570,8 @@
4553
4570
  return parts;
4554
4571
  }
4555
4572
 
4573
+ /** @hidden */
4574
+ var $preProcessorFailed = Symbol("$preProcessorFailed");
4556
4575
  var SnapshotProcessor = /** @class */ (function (_super) {
4557
4576
  __extends(SnapshotProcessor, _super);
4558
4577
  function SnapshotProcessor(_subtype, _processors, name) {
@@ -4597,6 +4616,19 @@
4597
4616
  return sn;
4598
4617
  }
4599
4618
  });
4619
+ Object.defineProperty(SnapshotProcessor.prototype, "preProcessSnapshotSafe", {
4620
+ enumerable: false,
4621
+ configurable: true,
4622
+ writable: true,
4623
+ value: function (sn) {
4624
+ try {
4625
+ return this.preProcessSnapshot(sn);
4626
+ }
4627
+ catch (e) {
4628
+ return $preProcessorFailed;
4629
+ }
4630
+ }
4631
+ });
4600
4632
  Object.defineProperty(SnapshotProcessor.prototype, "postProcessSnapshot", {
4601
4633
  enumerable: false,
4602
4634
  configurable: true,
@@ -4620,6 +4652,9 @@
4620
4652
  node.getSnapshot = function () {
4621
4653
  return _this.postProcessSnapshot(oldGetSnapshot.call(node));
4622
4654
  };
4655
+ node.getReconciliationType = function () {
4656
+ return _this;
4657
+ };
4623
4658
  }
4624
4659
  });
4625
4660
  Object.defineProperty(SnapshotProcessor.prototype, "instantiate", {
@@ -4662,7 +4697,10 @@
4662
4697
  configurable: true,
4663
4698
  writable: true,
4664
4699
  value: function (value, context) {
4665
- var processedSn = this.preProcessSnapshot(value);
4700
+ var processedSn = this.preProcessSnapshotSafe(value);
4701
+ if (processedSn === $preProcessorFailed) {
4702
+ return typeCheckFailure(context, value, "Failed to preprocess value");
4703
+ }
4666
4704
  return this._subtype.validate(processedSn, context);
4667
4705
  }
4668
4706
  });
@@ -4683,7 +4721,10 @@
4683
4721
  ? this._subtype
4684
4722
  : isStateTreeNode(thing)
4685
4723
  ? getSnapshot(thing, false)
4686
- : this.preProcessSnapshot(thing);
4724
+ : this.preProcessSnapshotSafe(thing);
4725
+ if (value === $preProcessorFailed) {
4726
+ return false;
4727
+ }
4687
4728
  return this._subtype.validate(value, [{ path: "", type: this._subtype }]).length === 0;
4688
4729
  }
4689
4730
  });
@@ -4695,6 +4736,18 @@
4695
4736
  return this._subtype.isAssignableFrom(type);
4696
4737
  }
4697
4738
  });
4739
+ Object.defineProperty(SnapshotProcessor.prototype, "isMatchingSnapshotId", {
4740
+ enumerable: false,
4741
+ configurable: true,
4742
+ writable: true,
4743
+ value: function (current, snapshot) {
4744
+ if (!(this._subtype instanceof ComplexType)) {
4745
+ return false;
4746
+ }
4747
+ var processedSn = this.preProcessSnapshot(snapshot);
4748
+ return this._subtype.isMatchingSnapshotId(current, processedSn);
4749
+ }
4750
+ });
4698
4751
  return SnapshotProcessor;
4699
4752
  }(BaseType));
4700
4753
  function proxyNodeTypeMethods(nodeType, snapshotProcessorType) {
@@ -4956,18 +5009,17 @@
4956
5009
  }
4957
5010
  var modelTypes = [];
4958
5011
  if (tryCollectModelTypes(this._subType, modelTypes)) {
4959
- var identifierAttribute_1 = undefined;
4960
- modelTypes.forEach(function (type) {
4961
- if (type.identifierAttribute) {
4962
- if (identifierAttribute_1 && identifierAttribute_1 !== type.identifierAttribute) {
4963
- throw fail$1("The objects in a map should all have the same identifier attribute, expected '" + identifierAttribute_1 + "', but child of type '" + type.name + "' declared attribute '" + type.identifierAttribute + "' as identifier");
4964
- }
4965
- identifierAttribute_1 = type.identifierAttribute;
5012
+ var identifierAttribute = modelTypes.reduce(function (current, type) {
5013
+ if (!type.identifierAttribute)
5014
+ return current;
5015
+ if (current && current !== type.identifierAttribute) {
5016
+ throw fail$1("The objects in a map should all have the same identifier attribute, expected '" + current + "', but child of type '" + type.name + "' declared attribute '" + type.identifierAttribute + "' as identifier");
4966
5017
  }
4967
- });
4968
- if (identifierAttribute_1) {
5018
+ return type.identifierAttribute;
5019
+ }, undefined);
5020
+ if (identifierAttribute) {
4969
5021
  this.identifierMode = MapIdentifierMode.YES;
4970
- this.mapIdentifierAttribute = identifierAttribute_1;
5022
+ this.mapIdentifierAttribute = identifierAttribute;
4971
5023
  }
4972
5024
  else {
4973
5025
  this.identifierMode = MapIdentifierMode.NO;
@@ -5009,7 +5061,7 @@
5009
5061
  Object.keys(hooks).forEach(function (name) {
5010
5062
  var hook = hooks[name];
5011
5063
  var actionInvoker = createActionInvoker(instance, name, hook);
5012
- ( addHiddenWritableProp)(instance, name, actionInvoker);
5064
+ (addHiddenWritableProp)(instance, name, actionInvoker);
5013
5065
  });
5014
5066
  });
5015
5067
  mobx.intercept(instance, this.willChange);
@@ -5351,7 +5403,7 @@
5351
5403
  Object.keys(hooks).forEach(function (name) {
5352
5404
  var hook = hooks[name];
5353
5405
  var actionInvoker = createActionInvoker(instance, name, hook);
5354
- ( addHiddenWritableProp)(instance, name, actionInvoker);
5406
+ (addHiddenWritableProp)(instance, name, actionInvoker);
5355
5407
  });
5356
5408
  });
5357
5409
  mobx.intercept(instance, this.willChange);
@@ -5686,13 +5738,17 @@
5686
5738
  if (oldNode.snapshot === newValue) {
5687
5739
  return true;
5688
5740
  }
5741
+ // Non object nodes don't get reconciled
5742
+ if (!(oldNode instanceof ObjectNode)) {
5743
+ return false;
5744
+ }
5745
+ var oldNodeType = oldNode.getReconciliationType();
5689
5746
  // new value is a snapshot with the correct identifier
5690
- return (oldNode instanceof ObjectNode &&
5691
- oldNode.identifier !== null &&
5747
+ return (oldNode.identifier !== null &&
5692
5748
  oldNode.identifierAttribute &&
5693
5749
  isPlainObject(newValue) &&
5694
- oldNode.identifier === normalizeIdentifier(newValue[oldNode.identifierAttribute]) &&
5695
- oldNode.type.is(newValue));
5750
+ oldNodeType.is(newValue) &&
5751
+ oldNodeType.isMatchingSnapshotId(oldNode, newValue));
5696
5752
  }
5697
5753
  /**
5698
5754
  * Returns if a given value represents an array type.
@@ -5751,11 +5807,11 @@
5751
5807
  return props;
5752
5808
  // its a function, maybe the user wanted a view?
5753
5809
  }
5754
- else if ( typeof value === "function") {
5810
+ else if (typeof value === "function") {
5755
5811
  throw fail$1("Invalid type definition for property '" + key + "', it looks like you passed a function. Did you forget to invoke it, or did you intend to declare a view / action?");
5756
5812
  // no other complex values
5757
5813
  }
5758
- else if ( typeof value === "object") {
5814
+ else if (typeof value === "object") {
5759
5815
  throw fail$1("Invalid type definition for property '" + key + "', it looks like you passed an object. Try passing another model type or a types.frozen.");
5760
5816
  // WTF did you pass in mate?
5761
5817
  }
@@ -5939,7 +5995,7 @@
5939
5995
  boundAction.$mst_middleware = middlewares;
5940
5996
  var actionInvoker = createActionInvoker(self, name, boundAction);
5941
5997
  actions[name] = actionInvoker;
5942
- ( addHiddenWritableProp)(self, name, actionInvoker);
5998
+ (addHiddenWritableProp)(self, name, actionInvoker);
5943
5999
  });
5944
6000
  }
5945
6001
  });
@@ -6021,7 +6077,7 @@
6021
6077
  mobx.makeObservable(self, (_a = {}, _a[key] = mobx.computed, _a));
6022
6078
  }
6023
6079
  else if (typeof descriptor.value === "function") {
6024
- ( addHiddenWritableProp)(self, key, descriptor.value);
6080
+ (addHiddenWritableProp)(self, key, descriptor.value);
6025
6081
  }
6026
6082
  else {
6027
6083
  throw fail$1("A view member should either be a function or getter based property");
@@ -6846,7 +6902,7 @@
6846
6902
  configurable: true,
6847
6903
  writable: true,
6848
6904
  value: function (current, newValue, parent, subpath) {
6849
- var type = this.determineType(newValue, current.type);
6905
+ var type = this.determineType(newValue, current.getReconciliationType());
6850
6906
  if (!type)
6851
6907
  throw fail$1("No matching type for union " + this.describe()); // can happen in prod builds
6852
6908
  return type.reconcile(current, newValue, parent, subpath);
@@ -7206,7 +7262,7 @@
7206
7262
  if (mustSucceed && t === undefined)
7207
7263
  throw fail$1("Late type seems to be used too early, the definition (still) returns undefined");
7208
7264
  if (t) {
7209
- if ( !isType(t))
7265
+ if (!isType(t))
7210
7266
  throw fail$1("Failed to determine subtype, make sure types.late returns a type definition.");
7211
7267
  this._subType = t;
7212
7268
  }