Mike's AI Tip: use discriminated unions to make AI code safer

Convex
284 views August 4, 2026

Model application state as a discriminated union so both TypeScript and your coding agent know exactly which fields are valid in every state. Learn more: https://www.convex.dev/typescript/advanced/type-operators-manipulation/typescript-discriminated-union #TypeScript #AICoding #Convex

Keyboard shortcuts

On. Switch them off if they collide with your assistive tools; ? still opens this sheet.

Go to

Press g then the letter.

  • gh Latest
  • gs Sources
  • gm Media
  • gv Videos
  • gp Podcasts
  • gc Calendar
  • gd Decoder
  • gz Dataviz
  • ga Datasets
  • gb Blog
  • gk Markets
  • gj Careers
  • gn Prompt Notebook

On this page

  • / Focus search, where there is one
  • t Back to top
  • ? This list
  • Esc Close