I can't understand the logic behind the terms intersection types and union types in TypeScript. I'm thinking of interfaces (or classes) as sets of properties.
The logical conjunction operator & is equivalent to intersection in set theory, defined as:
The intersection of two sets A and B, is the set containing all elements of A that also belong to B
In TypeScript, an Intersection Type is also built using the & operator and is defined as:
The intersection type of interface
Colorfuland interfaceCircleis a new type that has all the members ofColorfulandCircle
This is the exact opposite of how intersection is defined in mathematics and set theory.
I'm sure there is another way of looking at it, but I cannot figure it out.


T | Uismembers(T) | members(U)and similarly members ofT & Uare members of bothTandUso are in the intersection ofmembers(T)andmembers(U).∨ := ∪ (union),vmeansor, so union isor, which is represented with|in typescript.