'How do I merge two interface types with the overlapping properties' types being unioned?

How can I write a generic type alias, Combine<A, B>, that combines any two interfaces, A and B, while keeping matching properties from both but merging the property types using union?

For example, take these two interfaces:

interface Interface1 {
  type: string;
  another: bool;
}
interface Interface2 {
  type: number;
}

Then Combine<Interface1, Interface2> should evaluate to the type:

type Result = {
  type: string | number;
  another: bool;
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source