@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.
@@ -561,6 +561,12 @@ var StoreImpl = class {
561
561
  if (update === null || update === void 0) {
562
562
  return;
563
563
  }
564
+ if (typeof update !== "object" || Array.isArray(update)) {
565
+ throw new StoreError(
566
+ "INVALID_STATE_UPDATE" /* INVALID_STATE_UPDATE */,
567
+ `setState expects an object or a function returning one, got ${Array.isArray(update) ? "an array" : typeof update}`
568
+ );
569
+ }
564
570
  this.state = { ...this.state, ...withoutProtoKey(update) };
565
571
  this.notifyOrQueue(this.state, prevState);
566
572
  }
@@ -3152,5 +3158,5 @@ function compose(...middlewares) {
3152
3158
  }
3153
3159
 
3154
3160
  export { StoreError, StoreErrorCode, assertState, batch, combineComputed, combineEffects, combineSlices, combineValidators, compose, computed, createAsyncValidator, createDebouncedEffect, createEffect, createFederatedComputed, createFederatedSelector, createFederation, createFieldValidator, createLogger, createMockStorage, createNamespacedSlice, createSimpleEffect, createSimpleMiddleware, createSlice, createStorage, createStore, createSubscriber, createTestStore, createValidator, createWithMiddleware, deepClone, deepEqual, deepMerge, delay, devtools, effects, extendStore, flushMicrotasks, hasHistory, history, identity, immer, isFunction, logger, memoizeSelector, middlewareCompat, mockAction, omit, persist, pick, produce, resetSlices, selector, sessionStorage, shallowEqual, snapshot, spyOnStore, stateDiff, subscribeOnce, subscribeToMany, subscribeWithOptions, sync, toMiddlewareApi, triggerSync, validate, waitForFederated };
3155
- //# sourceMappingURL=chunk-R6MFYVYQ.js.map
3156
- //# sourceMappingURL=chunk-R6MFYVYQ.js.map
3161
+ //# sourceMappingURL=chunk-2ZNKQLNO.js.map
3162
+ //# sourceMappingURL=chunk-2ZNKQLNO.js.map