TypeScript Patterns for Large Codebases

TypeScript's real power shows in large codebases where type safety prevents entire classes of bugs. Here are the patterns I reach for most often.

Instead of optional fields and boolean flags, model states explicitly: