Skip to content

@yantrix/automata v0.5.2 • Docs


Yantrix API / @yantrix/automata / TContextTransformer

Type Alias: TContextTransformer()<StateType, ContextType> ​

ts
type TContextTransformer<StateType, ContextType>: (context) => TAutomataStateContext<StateType, ContextType>;

Represents a transformer function for the context of an automata state. This transformer can be added to the State Dictionary of the automata.

Type Parameters ​

• StateType extends TAutomataBaseStateType

The type of the automata state.

• ContextType extends { [K in StateType]: any } = Record<StateType, any>

The type of the context associated with each state.

Parameters ​

• context: TAutomataStateContext<StateType, ContextType>

The current state (and context) of the automata.

Returns ​

TAutomataStateContext<StateType, ContextType>

The transformed state (and context) of the automata.