Discriminated unions can model UI states precisely, helping TypeScript ensure each state is handled correctly.