createFsm
createFsm<
TCtx,TStates,TStateNames,TBubbles>(config):Fsm<TCtx, keyofTStates&string,TBubbles|Exclude<{ [S in string | number | symbol]: keyof TStates[S] & string }[keyofTStates],SpecialStateKeys> | { [S in string | number | symbol]: TStates[S] extends { _child: C } ? InputNamesOfInstance<C> : never }[keyofTStates],TBubbles>
Defined in: fsm.ts:241
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>>
TStateNames
Section titled “TStateNames”TStateNames extends string = keyof TStates & string
TBubbles
Section titled “TBubbles”TBubbles extends string = never
Parameters
Section titled “Parameters”config
Section titled “config”FsmConfig<TCtx, TStates, TStateNames, TBubbles>
Returns
Section titled “Returns”Fsm<TCtx, keyof TStates & string, TBubbles | Exclude<{ [S in string | number | symbol]: keyof TStates[S] & string }[keyof TStates], SpecialStateKeys> | { [S in string | number | symbol]: TStates[S] extends { _child: C } ? InputNamesOfInstance<C> : never }[keyof TStates], TBubbles>