Explain 'Branded Types' (Nominal Typing) in TypeScript.
Updated May 4, 2026
Short answer
Branding is a technique to simulate nominal typing in TypeScript's structural type system by adding a unique, hidden property.
Deep explanation
TypeScript uses structural typing (if it looks like a duck, it is a duck). However, sometimes you want to distinguish between two types that have the same structure—for example, a UserId and a PostId, which are both strings. By 'branding' a type with a unique property (usually an intersection with an object containing a literal string), you prevent them from being used interchangeably, catching logic errors at compile time.
Unlock with a Pro subscription to view this section.
View pricingReal-world example
No real-world example available yet.
Unlock with a Pro subscription to view this section.
Upgrade to ProCommon mistakes
No common mistakes listed yet.
Unlock with a Pro subscription to view this section.
Upgrade to ProFollow-up questions
No follow-up questions available yet.
Unlock with a Pro subscription to view this section.
Upgrade to Pro