Enforcing Disjoint Unions with TypeScript Conditional Types
TypeScript 2.8 introduced the conditional type operator, which allows for building comprehensive and powerful types. One of the more useful ones I’ve found is a “disjoint” type, which ensures that there are no elements in common between two sets or objects. This could also be referred to as “mutual exclusion.”