I can't understand the logic behind the terms union types and intersection types in TypeScript.
Pragmatically, if the properties of different types are sets of properties, if I combine them with the & operator, the resulting type will be the union of the of those sets. Following that logic, I would expect types like this to be called union types. If I combine them with |, I can only use the common properties of them, the intersection of the sets.
Wikipedia seems to back that logic:
The power set (set of all subsets) of any given nonempty set S forms a Boolean algebra, an algebra of sets, with the two operations ∨ := ∪ (union) and ∧ := ∩ (intersection).
However, according to typescriptlang.org, it's exactly the opposite: & is used to produce intersection types and | is used for union types.
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). - Leemembers(T)I meant the set of values of typeT, not the set of members defined byT. - Lee