HandlerDef
HandlerDef<
TCtx,TStateNames> =TStateNames|HandlerFn<TCtx,TStateNames> |MachinaInstance
Defined in: types.ts:364
The union of valid handler definition forms for a state input.
TStateNames— string shorthand, auto-transitions to that stateHandlerFn— function that returns a state name (transition) or void (stay)MachinaInstance— NOT a handler you’d write under an input key. It’s here becauseValidateStatestypes every state as the SAMERecordvalue type, which combines named properties (_onEnter,_onExit,_child,"*") with a[input: string]: HandlerDef<...>index signature covering everything else. TypeScript requires every named property’s type to be assignable to the index signature’s type, so_child?: MachinaInstanceonly type-checks ifHandlerDefitself includesMachinaInstancein its union. Remove this member and_child: someChildFsmstops compiling.
Type Parameters
Section titled “Type Parameters”TCtx
TStateNames
Section titled “TStateNames”TStateNames extends string = string