KeyedStateFactory
Defined in: state-keyed.ts:30
A factory object mapping state keys to state creator functions. Each function returns a State instance (optionally with additional properties).
Source
Section titled “Source”This interface is useful for defining a set of states in a state machine, allowing for dynamic state creation and management. It ensures that each state can be uniquely identified by its key, enabling type-safe transitions and state handling.
export interface KeyedStateFactory { [key: string]: (...args: any[]) => KeyedState;} /**
- defineStates - for creating type-safe state factories (uses matchboxFactory)
- createMachine - for building state machines from state factories
- FactoryMachine - for the main state machine type
These types are the underpinnings of the library, enabling type inference and state management throughout factory machines. The implementation leverages matchbox factories for dynamic and type-safe state construction and transitions.
Indexable
Section titled “Indexable”[key
: string
]: (…args
: any
[]) => KeyedState