ML
Topic

TypeScript

TypeScript patterns that prevent real bugs — discriminated unions, branded types, parse-don't-validate, and the type-level idioms that turn a refactor from a leap of faith into a compile-time confirmation.

2 articles · updated regularly

TypeScript
May 10, 20267 min

Branded Types for Domain Safety

UserId, OrderId, Email — all of them strings to the compiler, all of them disasters when accidentally swapped. Branded types are five lines of code that prevent the whole class.

TypeScriptPatterns
Read