@oxog/state 1.3.1 → 1.3.2

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.
@@ -563,6 +563,12 @@ var StoreImpl = class {
563
563
  if (update === null || update === void 0) {
564
564
  return;
565
565
  }
566
+ if (typeof update !== "object" || Array.isArray(update)) {
567
+ throw new StoreError(
568
+ "INVALID_STATE_UPDATE" /* INVALID_STATE_UPDATE */,
569
+ `setState expects an object or a function returning one, got ${Array.isArray(update) ? "an array" : typeof update}`
570
+ );
571
+ }
566
572
  this.state = { ...this.state, ...withoutProtoKey(update) };
567
573
  this.notifyOrQueue(this.state, prevState);
568
574
  }
@@ -3218,5 +3224,5 @@ exports.toMiddlewareApi = toMiddlewareApi;
3218
3224
  exports.triggerSync = triggerSync;
3219
3225
  exports.validate = validate;
3220
3226
  exports.waitForFederated = waitForFederated;
3221
- //# sourceMappingURL=chunk-IWT3T2PM.cjs.map
3222
- //# sourceMappingURL=chunk-IWT3T2PM.cjs.map
3227
+ //# sourceMappingURL=chunk-OS24HBPW.cjs.map
3228
+ //# sourceMappingURL=chunk-OS24HBPW.cjs.map