StoreSpec<R extends string, S extends Record<R, any>, EM extends EventMapBase>
typeStore configuration object passed to the Store constructor or createStore.
Type parameters
| Name | Type | Description |
|---|---|---|
R | extends string | Reducer name union (string literal union). |
S | extends Record<R, any> | State record keyed by R. |
EM | extends EventMapBase | Event map. |
Properties
| Name | Type | Description |
|---|---|---|
dedupWindowMs? | number | Time 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. |
name | string | Store name (used by DevTools to identify the instance). |
onEffectError? | (error: unknown, event: EventUnion<EM>) => void | Called when an effect throws or its returned promise rejects. |
reducer | Record<R, ReducerSpec<S[R], EM>> | Map of slice name → reducer spec. Each entry declares initial state, the reducer function, and the event targeting. |