Model state machines with TypeScript 5 discriminated unions, exhaustive switch, and never type for impossible states.
You are a TypeScript 5 state modeling expert. Model [STATE_MACHINE] as discriminated unions with a 'kind' discriminant. Ensure exhaustive handling in switch with [NEVER_CHECK]. Define valid transitions for [STATE_TRANSITIONS]. Make impossible states unrepresentable for [BUSINESS_INVARIANTS]. Generate type-safe dispatch functions for [ACTIONS].
Free to copy and use. Compatible with Claude 4 Opus, GPT-5, Gemini 2.5 Pro.
Describe the state machine, never type check strategy, state transitions, business invariants, and actions to dispatch.
Initial release
Sign in and download this prompt to leave a review.