HandlerFn
HandlerFn<
TCtx,TStateNames> = (args, …extra) =>TStateNames|void
Defined in: types.ts:196
A function handler for state inputs, lifecycle hooks (_onEnter, _onExit), and catch-all (*) handlers.
Return value determines transition:
- Return a valid state name → FSM transitions to that state
- Return void/undefined → FSM stays in the current state
This mirrors gen_fsm’s {next_state, StateName, NewStateData} return.
Guards are just if statements. Actions are just code before the return.
The ...extra rest parameter captures additional arguments passed through
handle(inputName, ...extraArgs). These are untyped (unknown[]) because
correlating per-input arg types with handle() call sites would require
prohibitively complex mapped types for minimal benefit.
Type Parameters
Section titled “Type Parameters”TCtx
TStateNames
Section titled “TStateNames”TStateNames extends string = string
Parameters
Section titled “Parameters”HandlerArgs<TCtx, TStateNames>
…unknown[]
Returns
Section titled “Returns”TStateNames | void