2 ms·
It's not +, but it's |, like OR which is the + of logical operators.
by rixed 1y ago
It's not +, but it's |, like OR which is the + of logical operators.
- andrewflnr 1y agoType sum is more like XOR though, in that it excludes overlap. I think of | for types as a set-like union type, with overlap allowed. At least that's how Typescript uses that operator (which makes sense for modeling JS APIs, but does not bring the joy of algebraic sums).