Discriminated unions
3 videos across 2 channels
Precise type safety in TypeScript hinges on discriminated unions to model failures and outcomes clearly, guiding developers from simple error handling to a robust, layered approach. The videos explore using literal and discriminated unions for narrowing, building a dedicated error system with Neverthrow, and applying these patterns across API and frontend boundaries to prevent subtle bugs. They also emphasize explicit return types and utility types to keep code expressive, maintainable, and resilient as complexity grows.

Stop Writing TypeScript Code Like This
The video explains why TypeScript’s return type inference is powerful but not always sufficient, and when you should exp

How To Handle Errors Like A Senior Dev
The video critiques naive, ad-hoc error handling and redirects in a Next.js/TypeScript app and walks through building a

5 Typescript tips you NEED to know
The video shares practical TypeScript tips to avoid common pitfalls, focusing on narrowing widened types, using literal