Type join is an operation to help reduce the necessaity to create new types. It is a way to combine multiple types into a single type.
Currently only two data types support joining, interfaces and structs. You cannot mix and match however, as joins are only allowed between the same data types.
Joining two types resuts in a new type combining both.
A rule of thumb when it comes to joining types is that if both types have the same field, the field type must be exactly the same on both types. Otherwise, the join will fail.
Interface Joins
Consider an interface join, when comparing actual values with an interface type join, the values must have a data type that represents a class that implements all of the interfaces in the type join. A type join is declared using the & operator. Here is an example:
Struct Joins
Struct joins are similar to interface joins.