La referencia de la API está disponible solo en inglés por ahora.

typedEvents

function
store/Store.ts:2112
signature
typedEvents<EM>(_): (channel: C, events: Evt) => readonly EventKey<EM>[]

Utility to define **typed** (channel, events[]) definitions for reducer specs.

Type parameters

NameTypeDescription
EMextends EventMapBaseEvent map for the store.

Parameters

NameTypeDescription
_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>>