createFsm
createFsm<
TCtx,TStates>(config):Fsm<TCtx,StateNamesOf<TStates>,InputNamesOf<TStates>>
Defined in: fsm.ts:217
Create a single-client FSM from a config object.
Generic parameters are inferred automatically:
TCtxcomes fromconfig.context(defaults to{}if omitted).TStatesis captured withconstinference to preserve string literal types, enabling compile-time validation of transition targets andhandle()input names.
State names, input names, and all handler signatures derive from TStates.
Type Parameters
Section titled “Type Parameters”TCtx extends object = Record<string, never>
TStates
Section titled “TStates”TStates extends Record<string, Record<string, unknown>> = Record<string, Record<string, unknown>>
Parameters
Section titled “Parameters”config
Section titled “config”FsmConfig<TCtx, TStates>
Returns
Section titled “Returns”Fsm<TCtx, StateNamesOf<TStates>, InputNamesOf<TStates>>