Type Alias On<D, P, G>

On<D, P, G>: [keyof Get<D, P>] extends [never]
    ? {
        [NEVER]?: never;
    }
    : IsStringLiteral<keyof Get<D, P>> extends false
        ? "Error: Event types must be literal strings."
        : {
            readonly [T in keyof Get<D, P>]: T extends ReservedKeyword
                ? `Error: Event type '${T}' is reserved.`
                : Extends<T, _EventTypeConstraint<D>> extends false
                    ? "Error: Event type is not defined in `$schema.events`."
                    : Transition<D, G>
        }

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

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.