According to the definition of intersection, the intersection of several types should produce a type whose properties are common to all types. For example, if we have:
type o1 = {a: string, b: string}
type o2 = {a: string, c: string}
type o3 = o1 & o2
Then o3
should be a type which only have property a
since a
is the common property to o1
and o2
. However, what we get actually is a type which have properties a
, b
and c
. In this case, it seems the intersection type doesn't act like what its name has shown. It acts more like a combination of all types. So does intersection types really have something to do with intersection? If not, why we call it intersection types instead of combination types or other names?