Skip to content

StoreTransitionRecord

Defined in: store-machine.ts:38

StoreTransitionRecord defines the structure of event-driven updates for StoreMachine. Each event type maps to a function that takes any params and returns either:

  • a value of type T
  • or a function that takes a StoreChange and returns T

Example:

const transitions: StoreTransitionRecord<number> = {
increment: (amount = 1) => (change) => change.from + amount,
set: (next) => next,
custom: () => (change) => change.from * 2,
};
Type Parameter
T

[event: string]: DirectTransition<T> | CurriedTransition<T>