Skip to content

InputNamesOf

InputNamesOf<TStates> = OwnInputNamesOf<TStates> | ChildInputNamesOf<TStates>

Defined in: types.ts:93

Extracts input names as a string literal union from a states config object. This is what flows into handle(inputName) to provide compile-time validation of input names.

A parent’s handle() genuinely accepts everything its _child FSMs accept: the engine checks the child first and only falls through to the parent’s own handlers if the child can’t handle the input (see BehavioralFsm.handle). InputNamesOf mirrors that at the type level by unioning the config’s own input names with every declared child’s input names (recursively — grandchildren ride along because each child’s own InputNamesOfInstance already folded in ITS children when that child was created).

TStates

type I = InputNamesOf<{
  idle:    { start: "running", reset: fn };
  running: { pause: "paused", stop: "idle" };
}>;
// => "start" | "reset" | "pause" | "stop"