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 pricing

Real-world example

No real-world example available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Common mistakes

No common mistakes listed yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Follow-up questions

No follow-up questions available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

More TypeScript interview questions

View all →