packages/typescript-to-proptypes/src/types/props.ts/createUnionType
export function createUnionType(types: PropType[]): UnionType {
  const flatTypes: PropType[] = [];

  function flattenTypes(nodes: PropType[]) {
    nodes.forEach((type) => {
      if (type.type === 'UnionNode') {
        flattenTypes(type.types);
      } else {
        flatTypes.push(type);
      }
    });
  }

  flattenTypes(types);

  return uniqueUnionTypes({
    type: 'UnionNode',
    types: flatTypes,
  });
}