@oxog/state 1.2.0 → 1.3.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.
package/dist/index.d.ts CHANGED
@@ -34,7 +34,7 @@ type DeepPartial<T> = T extends object ? {
34
34
  * });
35
35
  * ```
36
36
  */
37
- type Action<TState, TArgs extends unknown[] = []> = (state: TState, ...args: TArgs) => Partial<TState> | Promise<Partial<TState>>;
37
+ type Action<TState, TArgs extends unknown[] = any[]> = (state: TState, ...args: TArgs) => Partial<TState> | void | Promise<Partial<TState> | void>;
38
38
  /**
39
39
  * Collection of actions indexed by name.
40
40
  *
@@ -48,7 +48,46 @@ type Action<TState, TArgs extends unknown[] = []> = (state: TState, ...args: TAr
48
48
  * };
49
49
  * ```
50
50
  */
51
- type Actions<TState> = Record<string, Action<TState>>;
51
+ type Actions<TState> = Record<string, Action<TState, any[]>>;
52
+ /**
53
+ * The bound form of an action: the `state` argument is supplied by the store.
54
+ *
55
+ * @example
56
+ * ```typescript
57
+ * type Fn = BoundAction<(state: { n: number }, by: number) => { n: number }>;
58
+ * // (by: number) => { n: number }
59
+ * ```
60
+ */
61
+ type BoundAction<F> = F extends (state: any, ...args: infer A) => infer R ? (...args: A) => R : never;
62
+ /**
63
+ * Bound versions of a map of actions.
64
+ */
65
+ type BoundActions<TActions> = {
66
+ [K in keyof TActions]: BoundAction<TActions[K]>;
67
+ };
68
+ /**
69
+ * Bound versions of the inline (`$`-prefixed) actions of an initial state,
70
+ * keyed without the `$` prefix.
71
+ */
72
+ type InlineActions<T> = {
73
+ [K in keyof T as K extends `$${infer Name}` ? T[K] extends (...args: any[]) => any ? Name : never : never]: BoundAction<T[K]>;
74
+ };
75
+ /**
76
+ * An initial state without its inline (`$`-prefixed) action functions.
77
+ */
78
+ type StateWithoutInlineActions<T> = [Extract<keyof T, `$${string}`>] extends [never] ? T : {
79
+ [K in keyof T as K extends `$${string}` ? T[K] extends (...args: any[]) => any ? never : K : K]: T[K];
80
+ };
81
+ /**
82
+ * The state type of a store created from `initialState` and `actions`:
83
+ * data plus every bound action.
84
+ */
85
+ type StateWithActions<T, TActions = {}> = [Extract<keyof T, `$${string}`>] extends [never] ? [keyof TActions] extends [never] ? T : T & BoundActions<TActions> : StateWithoutInlineActions<T> & InlineActions<T> & BoundActions<TActions>;
86
+ /**
87
+ * The store returned by `createStore`: the store API plus every bound action
88
+ * as a method.
89
+ */
90
+ type CreatedStore<T, TActions = {}> = StoreBuilder<StateWithActions<T, TActions>> & InlineActions<T> & BoundActions<TActions>;
52
91
  /**
53
92
  * Selector function to extract a slice of state.
54
93
  *
@@ -264,7 +303,7 @@ interface Store<TState> {
264
303
  * store.use(persist({ key: 'app' }));
265
304
  * ```
266
305
  */
267
- use<TPlugin extends Plugin<TState>>(plugin: TPlugin, options?: unknown): this;
306
+ use(plugin: Plugin<TState>, options?: unknown): this;
268
307
  /** Destroy store and cleanup all resources */
269
308
  destroy(): void;
270
309
  }
@@ -288,7 +327,9 @@ interface StoreBuilder<TState> extends Store<TState> {
288
327
  * @param fn - Action function
289
328
  * @returns The builder for chaining
290
329
  */
291
- action<K extends string>(name: K, fn: Action<TState & Record<K, Action<TState>>>): this;
330
+ action<K extends string, F extends Action<TState, any[]>>(name: K, fn: F): this & {
331
+ [P in K]: BoundAction<F>;
332
+ };
292
333
  }
293
334
  /**
294
335
  * Error codes for store errors.
@@ -313,6 +354,37 @@ declare class StoreError extends Error {
313
354
  constructor(code: StoreErrorCode, message: string);
314
355
  }
315
356
 
357
+ /**
358
+ * Batch multiple state updates into a single notification.
359
+ *
360
+ * This reduces the number of subscriber notifications when making multiple
361
+ * state updates in sequence. All updates within the batch function will
362
+ * result in only one notification to subscribers.
363
+ *
364
+ * @param fn - Function containing state updates
365
+ * @returns The return value of fn
366
+ *
367
+ * @example
368
+ * ```typescript
369
+ * import { batch, createStore } from '@oxog/state';
370
+ *
371
+ * const store = createStore({ count: 0, name: '' });
372
+ *
373
+ * // Without batch - 3 re-renders in React
374
+ * store.setState({ count: 1 });
375
+ * store.setState({ count: 2 });
376
+ * store.setState({ name: 'John' });
377
+ *
378
+ * // With batch - 1 re-render in React
379
+ * batch(() => {
380
+ * store.setState({ count: 1 });
381
+ * store.setState({ count: 2 });
382
+ * store.setState({ name: 'John' });
383
+ * });
384
+ * ```
385
+ */
386
+ declare function batch<T>(fn: () => T): T;
387
+
316
388
  /**
317
389
  * Create a new reactive store.
318
390
  *
@@ -345,31 +417,9 @@ declare class StoreError extends Error {
345
417
  * .action('increment', (state) => ({ count: state.count + 1 }));
346
418
  * ```
347
419
  */
348
- declare function createStore<TState>(initialState: TState, actions?: Actions<TState>): Store<TState>;
349
- /**
350
- * Batch multiple state updates into a single notification.
351
- *
352
- * @param fn - Function containing state updates
353
- * @returns The return value of fn
354
- *
355
- * @example
356
- * ```typescript
357
- * import { batch } from '@oxog/state';
358
- *
359
- * // Without batch - 3 re-renders
360
- * store.setState({ a: 1 });
361
- * store.setState({ b: 2 });
362
- * store.setState({ c: 3 });
363
- *
364
- * // With batch - 1 re-render
365
- * batch(() => {
366
- * store.setState({ a: 1 });
367
- * store.setState({ b: 2 });
368
- * store.setState({ c: 3 });
369
- * });
370
- * ```
371
- */
372
- declare function batch<T>(fn: () => T): T;
420
+ declare function createStore<TState, TActions extends {
421
+ [K in keyof TActions]: Action<TState, any[]>;
422
+ } = {}>(initialState: TState, actions?: TActions & Record<string, Action<TState, any[]>>): CreatedStore<TState, TActions>;
373
423
 
374
424
  /**
375
425
  * React hook for subscribing to store state changes.
@@ -422,7 +472,9 @@ declare function useStore<TState, TSelected = TState>(store: Store<TState>, sele
422
472
  /**
423
473
  * React hook for creating and using a store.
424
474
  *
425
- * Creates a store on first render and destroys it on unmount.
475
+ * Creates a store on first render and destroys it after the component
476
+ * unmounts. Safe under React StrictMode (the simulated unmount/remount in
477
+ * development does not destroy the store).
426
478
  *
427
479
  * @typeParam TState - The store state type
428
480
  * @param initialState - The initial state
@@ -705,7 +757,7 @@ declare function subscribeWithOptions<TState, TSelected>(store: Store<TState>, s
705
757
  * );
706
758
  * ```
707
759
  */
708
- declare function createSubscriber<TState>(defaultOptions?: SubscribeOptions<TState, any>): <TSelected>(store: Store<TState>, selector: Selector<TState, TSelected>, listener: Listener<TSelected>, options?: SubscribeOptions<TState, TSelected>) => () => void;
760
+ declare function createSubscriber<TState = any>(defaultOptions?: SubscribeOptions<TState, any>): <S extends TState, TSelected>(store: Store<S>, selector: Selector<S, TSelected>, listener: Listener<TSelected>, options?: SubscribeOptions<S, TSelected>) => () => void;
709
761
  /**
710
762
  * Subscribe to multiple selectors with a single listener.
711
763
  *
@@ -761,10 +813,10 @@ declare function subscribeOnce<TState, TSelected>(store: Store<TState>, selector
761
813
  /**
762
814
  * Options for computed values.
763
815
  *
764
- * @typeParam T - The store state type
816
+ * @typeParam _TState - The store state type (unused, kept for compatibility)
765
817
  * @typeParam U - The computed value type
766
818
  */
767
- interface ComputedOptions<T, U> {
819
+ interface ComputedOptions<_TState, U> {
768
820
  /** Custom equality for caching */
769
821
  equals?: EqualityFn<U>;
770
822
  /** Lazy evaluation (only compute when accessed) */
@@ -875,10 +927,7 @@ declare function memoizeSelector<TState, TSelected>(selector: Selector<TState, T
875
927
  /**
876
928
  * SetSlice function type for updating slice state.
877
929
  */
878
- type SetSlice<TState> = {
879
- (partial: Partial<TState>): void;
880
- (updater: (state: TState) => Partial<TState>): void;
881
- };
930
+ type SetSlice<TState> = (partial: Partial<TState> | ((state: TState) => Partial<TState>)) => void;
882
931
  /**
883
932
  * GetSlice function type for getting current state.
884
933
  */
@@ -934,7 +983,7 @@ interface SliceDefinition<TState, TSlice extends Partial<TState>> {
934
983
  * store.setUser({ name: 'John' });
935
984
  * ```
936
985
  */
937
- declare function createSlice<TState, TSlice extends Partial<TState>>(name: string, creator: SliceCreator<TState, TSlice>): SliceDefinition<TState, TSlice>;
986
+ declare function createSlice<TState = any, TSlice extends Partial<TState> = Partial<TState>>(name: string, creator: SliceCreator<TState, TSlice>): SliceDefinition<TState, TSlice>;
938
987
  /**
939
988
  * Internal slice creator type for type inference.
940
989
  */
@@ -942,11 +991,12 @@ type InferSlice<T> = T extends SliceDefinition<any, infer S> ? S : never;
942
991
  /**
943
992
  * Combined state type from multiple slices.
944
993
  */
945
- type CombinedState<TSlices extends SliceDefinition<any, any>[]> = {
994
+ type UnionToIntersection<U> = (U extends unknown ? (value: U) => void : never) extends (value: infer I) => void ? I : never;
995
+ type CombinedState<TSlices extends SliceDefinition<any, any>[]> = UnionToIntersection<{
946
996
  [K in keyof TSlices]: InferSlice<TSlices[K]>;
947
- }[number] extends infer U ? U extends object ? {
948
- [K in keyof U as U extends Record<K, any> ? K : never]: U[K];
949
- } : never : never;
997
+ }[number]> extends infer I ? {
998
+ [K in keyof I]: I[K];
999
+ } : never;
950
1000
  /**
951
1001
  * Combine multiple slices into a single store.
952
1002
  *
@@ -1083,6 +1133,8 @@ interface Federation<Stores extends Record<string, Store<any>>> {
1083
1133
  transactionAsync(fn: TransactionFn<Stores>): Promise<void>;
1084
1134
  /** Get a specific store */
1085
1135
  getStore<K extends keyof Stores>(name: K): Stores[K];
1136
+ /** Subscribe to the changes of one member store. */
1137
+ subscribeStore<K extends keyof Stores>(name: K, listener: (state: StoreState<Stores[K]>, prevState: StoreState<Stores[K]>) => void): () => void;
1086
1138
  /** Destroy federation and unsubscribe from all stores */
1087
1139
  destroy(): void;
1088
1140
  }
@@ -1574,6 +1626,10 @@ declare function triggerSync<TState>(store: Store<TState>, channel?: string): vo
1574
1626
  /**
1575
1627
  * Produce a new state by applying mutations to a draft.
1576
1628
  *
1629
+ * Copy-on-write: only the objects and arrays on the path of a change are
1630
+ * copied, untouched branches keep their identity, and `base` is never
1631
+ * mutated. If the recipe returns an object, that object is the result.
1632
+ *
1577
1633
  * @param base - The base state
1578
1634
  * @param recipe - The mutation function
1579
1635
  * @returns The new state
@@ -1586,12 +1642,16 @@ declare function triggerSync<TState>(store: Store<TState>, channel?: string): vo
1586
1642
  * const newState = produce(state, (draft) => {
1587
1643
  * draft.users[0].age = 31;
1588
1644
  * });
1645
+ * // state is unchanged; newState.users[0].age === 31
1589
1646
  * ```
1590
1647
  */
1591
- declare function produce<T>(base: T, recipe: (draft: T) => void): T;
1648
+ declare function produce<T>(base: T, recipe: (draft: T) => T | Partial<T> | void): T;
1592
1649
  /**
1593
1650
  * Create an immer plugin.
1594
1651
  *
1652
+ * With the plugin installed, `setState` accepts a recipe that mutates a
1653
+ * draft. Regular updaters that return a partial state keep working.
1654
+ *
1595
1655
  * @returns An immer plugin
1596
1656
  *
1597
1657
  * @example
@@ -1621,17 +1681,19 @@ declare function immer<TState>(): Plugin<TState>;
1621
1681
  * import { createStore, selector } from '@oxog/state';
1622
1682
  *
1623
1683
  * const store = createStore({
1624
- * items: [],
1684
+ * items: [] as { status: string }[],
1625
1685
  * filter: 'all',
1686
+ * filteredItems: [] as { status: string }[],
1687
+ * itemCount: 0,
1626
1688
  * })
1627
1689
  * .use(selector({
1628
- * // Computed: filtered items
1629
- * filteredItems: (state) => {
1630
- * if (state.filter === 'all') return state.items;
1631
- * return state.items.filter((item: any) => item.status === state.filter);
1690
+ * selectors: {
1691
+ * // Computed: filtered items
1692
+ * filteredItems: (state) =>
1693
+ * state.filter === 'all' ? state.items : state.items.filter((item) => item.status === state.filter),
1694
+ * // Computed: item count
1695
+ * itemCount: (state) => state.items.length,
1632
1696
  * },
1633
- * // Computed: item count
1634
- * itemCount: (state) => state.items.length,
1635
1697
  * }));
1636
1698
  *
1637
1699
  * // Access computed values
@@ -1779,14 +1841,20 @@ type EffectFn<T> = (value: T, prevValue: T, utils: EffectUtils) => void | Effect
1779
1841
  interface EffectUtils {
1780
1842
  /** Get current store state */
1781
1843
  getState: () => unknown;
1782
- /** Set store state */
1844
+ /**
1845
+ * Set store state. Ignored once this run is no longer active (superseded
1846
+ * by a newer run, cancelled, or the store was destroyed), so a slow earlier
1847
+ * run cannot overwrite the result of a later one.
1848
+ */
1783
1849
  setState: (partial: any) => void;
1784
- /** Check if effect is still active (not cancelled) */
1850
+ /** Check if this run is still active (not superseded, cancelled or destroyed) */
1785
1851
  isActive: () => boolean;
1786
- /** Cancel this effect */
1852
+ /** Cancel this run */
1787
1853
  cancel: () => void;
1788
- /** Run a callback only if effect is active */
1854
+ /** Run a callback only if this run is active */
1789
1855
  onlyIfActive: <T>(fn: () => T) => T | undefined;
1856
+ /** Aborted when this run is superseded, cancelled or the store is destroyed (pass it to fetch). */
1857
+ signal: AbortSignal;
1790
1858
  }
1791
1859
  /**
1792
1860
  * Effect definition for the effects plugin.
@@ -1998,25 +2066,33 @@ interface YupLikeSchema<T> {
1998
2066
  abortEarly?: boolean;
1999
2067
  }): Promise<T>;
2000
2068
  }
2001
- /**
2002
- * Schema type - supports Zod, Yup, or custom validators.
2003
- */
2004
- type Schema<T> = ZodLikeSchema<T> | YupLikeSchema<T> | ValidatorFn<T>;
2005
2069
  /**
2006
2070
  * Validation timing options.
2007
2071
  */
2008
2072
  type ValidationTiming = 'change' | 'commit' | 'manual';
2073
+ /**
2074
+ * Blocks inference from the schema, so the state type comes from the store
2075
+ * (`store.use(validate(...))`) and `paths` stays typed with a Zod/Yup schema.
2076
+ */
2077
+ type NoInferState<T> = [T][T extends any ? 0 : never];
2009
2078
  /**
2010
2079
  * Validation plugin options.
2011
2080
  */
2012
2081
  interface ValidateOptions<T> {
2013
2082
  /** Schema to validate against (Zod, Yup, or custom function) */
2014
- schema: Schema<T>;
2015
- /** When to validate: 'change' (every setState), 'commit' (on batch commit), 'manual' (only when validate() called) */
2083
+ schema: ZodLikeSchema<unknown> | YupLikeSchema<unknown> | ValidatorFn<NoInferState<T>>;
2084
+ /**
2085
+ * When to validate: 'change' (after every state change) or 'manual' (only
2086
+ * when validate() is called). 'commit' is currently handled like 'manual'.
2087
+ */
2016
2088
  on?: ValidationTiming;
2017
2089
  /** Callback when validation fails */
2018
2090
  onError?: (errors: ValidationError[]) => void;
2019
- /** Throw error on validation failure */
2091
+ /**
2092
+ * Make validate() throw on failure. Validation on change runs inside a
2093
+ * store listener, so there the error is reported through the store's error
2094
+ * handling (console.error / plugin onError) and the update is kept.
2095
+ */
2020
2096
  throwOnError?: boolean;
2021
2097
  /** Only validate these paths (keys of state) */
2022
2098
  paths?: Array<keyof T>;
@@ -2127,7 +2203,7 @@ declare function validate<TState>(options: ValidateOptions<TState>): Plugin<TSta
2127
2203
  * .use(validate({ schema: isPositive }));
2128
2204
  * ```
2129
2205
  */
2130
- declare function createValidator<T>(predicate: (state: T) => boolean, message: string): ValidatorFn<T>;
2206
+ declare function createValidator<T>(predicate: (state: T) => boolean, message: string): (state: T) => ValidationResult;
2131
2207
  /**
2132
2208
  * Combine multiple validators into one.
2133
2209
  *
@@ -2145,7 +2221,7 @@ declare function createValidator<T>(predicate: (state: T) => boolean, message: s
2145
2221
  * .use(validate({ schema: combinedValidator }));
2146
2222
  * ```
2147
2223
  */
2148
- declare function combineValidators<T>(...validators: ValidatorFn<T>[]): ValidatorFn<T>;
2224
+ declare function combineValidators<T>(...validators: ValidatorFn<T>[]): (state: T) => ValidationResult;
2149
2225
  /**
2150
2226
  * Create a field-level validator.
2151
2227
  *
@@ -2166,7 +2242,7 @@ declare function combineValidators<T>(...validators: ValidatorFn<T>[]): Validato
2166
2242
  * .use(validate({ schema: emailValidator }));
2167
2243
  * ```
2168
2244
  */
2169
- declare function createFieldValidator<T, K extends keyof T>(field: K, predicate: (value: T[K], state: T) => boolean, message: string): ValidatorFn<T>;
2245
+ declare function createFieldValidator<T, K extends keyof T>(field: K, predicate: (value: T[K], state: T) => boolean, message: string): (state: T) => ValidationResult;
2170
2246
  /**
2171
2247
  * Create an async validator (for server-side validation).
2172
2248
  *
@@ -2277,6 +2353,7 @@ declare function shallowEqual(a: unknown, b: unknown): boolean;
2277
2353
  */
2278
2354
 
2279
2355
  declare function deepMerge<T>(target: T, source: Partial<T> | DeepPartial<T>): T;
2356
+ declare function deepMerge<T, S extends object>(target: T, source: S): T & S;
2280
2357
 
2281
2358
  /**
2282
2359
  * Type guard to check if a value is a function.
@@ -2654,7 +2731,7 @@ interface MiddlewareStoreApi<T> {
2654
2731
  /**
2655
2732
  * State creator function for middleware pattern.
2656
2733
  */
2657
- type StateCreatorFn<T, Mps extends unknown[] = [], Mcs extends unknown[] = []> = (set: MiddlewareSetState<T>, get: MiddlewareGetState<T>, api: MiddlewareStoreApi<T>) => T;
2734
+ type StateCreatorFn<T, _Mps extends unknown[] = [], _Mcs extends unknown[] = []> = (set: MiddlewareSetState<T>, get: MiddlewareGetState<T>, api: MiddlewareStoreApi<T>) => T;
2658
2735
  /**
2659
2736
  * Generic Middleware type.
2660
2737
  */
@@ -2695,7 +2772,7 @@ declare function toMiddlewareApi<T>(store: Store<T>): MiddlewareStoreApi<T>;
2695
2772
  * .use(middlewareCompat(someMiddleware, { name: 'MyStore' }));
2696
2773
  * ```
2697
2774
  */
2698
- declare function middlewareCompat<T>(middleware: MiddlewareFn<T>, options?: Record<string, unknown>): Plugin<T>;
2775
+ declare function middlewareCompat<T>(middleware: MiddlewareFn<T>, _options?: Record<string, unknown>): Plugin<T>;
2699
2776
  /**
2700
2777
  * Create a store using middleware-style state creator.
2701
2778
  *
@@ -2719,7 +2796,7 @@ declare function middlewareCompat<T>(middleware: MiddlewareFn<T>, options?: Reco
2719
2796
  * ```
2720
2797
  */
2721
2798
  declare function createWithMiddleware<T extends object>(creator: StateCreatorFn<T>): MiddlewareStoreApi<T> & {
2722
- use: <U>(plugin: Plugin<T>) => MiddlewareStoreApi<T>;
2799
+ use: (plugin: Plugin<T>) => MiddlewareStoreApi<T>;
2723
2800
  };
2724
2801
  /**
2725
2802
  * Create a simple middleware.
@@ -2778,4 +2855,4 @@ type SelectorFn<T, U> = (state: T) => U;
2778
2855
  */
2779
2856
  type EqualityCheck<T> = (a: T, b: T) => boolean;
2780
2857
 
2781
- export { type Action, type Actions, type Computed, type ComputedOptions, type DeepPartial, type DevtoolsOptions, type EffectCleanup, type EffectDefinition, type EffectFn, type EffectUtils, type EffectsOptions, type EqualityCheck, type EqualityFn, type ExtractStateType, type FederatedState, type Federation, type FederationListener, type FederationOptions, type GetSlice, type HistoryOptions, type HistoryStore, type Listener, type LogLevel, type LoggerOptions, type MiddlewareFn, type MiddlewareGetState, type MiddlewareSetState, type MiddlewareStoreApi, type MiddlewareSubscribe, type MockStorage, type MockedAction, type PersistOptions, type Plugin, type Selector, type SelectorFn, type SelectorOptions, type SetSlice, type SliceCreator, type SliceDefinition, type StateAssertion, type StateChange, type StateCreatorFn, type StorageLike$1 as StorageLike, type Store, type StoreBuilder, StoreError, StoreError as StoreErrorClass, StoreErrorCode, type StoreOptions, type StoreSpy, type StoreState, type SubscribeOptions, type SyncOptions, type TestStore, type TestStoreOptions, type TransactionFn, type ValidateOptions, type ValidationAPI, type ValidationError, type ValidationResult, type ValidationTiming, type ValidatorFn, 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, useAction, useCreateStore, useSetState, useShallow, useStore, useStoreActions, useStoreSelector, useTransientSubscribe, validate, waitForFederated };
2858
+ export { type Action, type Actions, type BoundAction, type BoundActions, type Computed, type ComputedOptions, type CreatedStore, type DeepPartial, type DevtoolsOptions, type EffectCleanup, type EffectDefinition, type EffectFn, type EffectUtils, type EffectsOptions, type EqualityCheck, type EqualityFn, type ExtractStateType, type FederatedState, type Federation, type FederationListener, type FederationOptions, type GetSlice, type HistoryOptions, type HistoryStore, type InlineActions, type Listener, type LogLevel, type LoggerOptions, type MiddlewareFn, type MiddlewareGetState, type MiddlewareSetState, type MiddlewareStoreApi, type MiddlewareSubscribe, type MockStorage, type MockedAction, type PersistOptions, type Plugin, type Selector, type SelectorFn, type SelectorOptions, type SetSlice, type SliceCreator, type SliceDefinition, type StateAssertion, type StateChange, type StateCreatorFn, type StateWithActions, type StateWithoutInlineActions, type StorageLike$1 as StorageLike, type Store, type StoreBuilder, StoreError, StoreError as StoreErrorClass, StoreErrorCode, type StoreOptions, type StoreSpy, type StoreState, type SubscribeOptions, type SyncOptions, type TestStore, type TestStoreOptions, type TransactionFn, type ValidateOptions, type ValidationAPI, type ValidationError, type ValidationResult, type ValidationTiming, type ValidatorFn, 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, useAction, useCreateStore, useSetState, useShallow, useStore, useStoreActions, useStoreSelector, useTransientSubscribe, validate, waitForFederated };