typedEvents
functionsignature
typedEvents<EM>(_): (channel: C, events: Evt) => readonly EventKey<EM>[]Utility to define **typed** (channel, events[]) definitions for reducer specs.
Type parameters
| Name | Type | Description |
|---|---|---|
EM | extends EventMapBase | Event map for the store. |
Parameters
| Name | Type | Description |
|---|---|---|
_ | string[][] | Internal marker parameter (usually events array placeholder). Not used at runtime. |
Returns
(channel: C, events: Evt) => readonly EventKey<EM>[] — A helper that, given a channel and a readonly events array, returns typed event keys.
Example
example
// In a ReducerSpec:
const events = typedEvents<EM>([])('ui', ['increment', 'decrement'] as const);
// events: ReadonlyArray<EventKey<EM>>