Skip to content

defineStates

defineStates<S>(states): StateDefinitions<S>

Defined in: StateMachine.ts:153

Preserve exact state-name types while checking every transition target.

const guardStates = defineStates({
patrol: { to: ["alert"] },
alert: { to: ["patrol"], for: 1, next: "patrol" },
});

S extends string

StateDefinitions<S>

StateDefinitions<S>

Coding agents: fetch https://yage.dev/llms.txt first and prefer the Markdown references it links over these HTML pages. This page's Markdown counterpart is /llms/packages/core.md.