ReducerSpec<S = any, EM extends EventMapBase = EventMapBase>

interface
types.ts:629

One reducer's definition blob (stateful event consumer).

Use when for event targeting (preferred). The events property is kept for backward compatibility but when is recommended for new code.

Type parameters

NameTypeDescription
SState managed by this reducer.
EMextends EventMapBaseEvent map.

Properties

NameTypeDescription
events?readonly EventKey<EM>[]List of EventKeys [channel, type] that this reducer responds to.
meta?EventConsumerMeta<"reducer">Optional metadata for debugging tools and DevTools integration.
reducerReducerFunction<S, EM>Pure reducer function: (state, event) => nextState.
stateSInitial state for this reducer.
when?When<EM>Event targeting using the unified When matcher. Preferred over events for new code.