TypeScript Professional — Hard
Key points
- Opaque type with __brand enforces nominal typing
- UserId and ProductId are distinct despite being strings
- Prevents accidental interchangeability at runtime
- __brand property adds unique identity to the types
Ready to go further?
Related questions
