TypeScript: Branded Types 🔧
PART 1: TypeScript Mapped Type MagicAhoy there TypeScript warriors! 👋 Today we're extending our work in the TypeScript mapped types article to provide branding. The previous article discussed how to use TypeScript mapped types in a nominal rather than structural nature.type A = {
x: number
}
type B = {
x: number
}This is a fancy way of saying TypeScript is structural by default, i.e. it will see type A and B as equal when dealing with types. Making type A and B nominal would make TypeScript dif...
Read more at prosopo.io