Type Alias State<D, P, G, E>

State<D, P, G, E>: {
    effect?: [E] extends [never]
        ? "Error: Effects are not defined."
        : IsStringLiteral<E> extends false
            ? "Error: Effects must be literal strings."
            : Definition.Effect<E>;
    on?: On<D, [...P, "on"], G>;
}

The state definition.

Type Parameters

  • D

    The type of definition for state machine.

  • P extends ReadonlyArray<keyof any>

    The type of path from definition root to here.

  • G extends string

    The type of guards for state machine functions.

  • E extends string

    The type of effects for state machine functions.

Type declaration

  • Optional Readonlyeffect?: [E] extends [never]
        ? "Error: Effects are not defined."
        : IsStringLiteral<E> extends false
            ? "Error: Effects must be literal strings."
            : Definition.Effect<E>

    The actions to perform when the state is entered.

  • Optional Readonlyon?: On<D, [...P, "on"], G>

    The type of definition how a state machine will transition when it receives a specific event.