StoreSpec<R extends string, S extends Record<R, any>, EM extends EventMapBase>

type
types.ts:284

Store configuration object passed to the Store constructor or createStore.

Type parameters

NameTypeDescription
Rextends stringReducer name union (string literal union).
Sextends Record<R, any>State record keyed by R.
EMextends EventMapBaseEvent map.

Properties

NameTypeDescription
dedupWindowMs?numberTime window in milliseconds for **content-based** event deduplication. When greater than 0, events with identical fingerprints (channel + type + serialized payload) within this window are treated as duplicates and skipped. **Off by default.** Content-based dedup can silently drop legitimate rapid-fire identical events (double-clicks, repeated +1, sliders emitting the same value), so it is opt-in. To safely coalesce a *specific* re-fired emit (e.g. React Strict Mode), prefer the per-emit EmitOptions.dedupKey.
devtools?{ allowReplay?: boolean }DevTools configuration options.
effects?EffectSpec<DeepReadonly<S>, EM>[]Optional side-effect handlers registered at construction time. Runs after reducers for every propagated event.
middleware?MiddlewareInput<DeepReadonly<S>, EM>[]Middleware chain executed before reducers/effects. Accepts either functions (legacy) or MiddlewareSpec objects (recommended). If any middleware returns false (or resolves to false), the event will not propagate.
namestringStore name (used by DevTools to identify the instance).
onEffectError?(error: unknown, event: EventUnion<EM>) => voidCalled when an effect throws or its returned promise rejects.
reducerRecord<R, ReducerSpec<S[R], EM>>Map of slice name → reducer spec. Each entry declares initial state, the reducer function, and the event targeting.