Skip to content

Support for UnionToIntersection #69

@haejunejung

Description

@haejunejung

It provides support for UnionToIntersection.

It converts a union type into an intersection type. In a union type, you can choose one type from the options, but in an intersection type, you combin the properties of all types involved.

UntionToIntersection is especially useful when you need to combine multiple types' properties into a single type in more complex senarios, such as with mixins or when dealing with generics.

type A = { a: string };
type B = { b: string };

type Union = A | B; // A or B can be selected, but not both at once.
type Intersection = A & B // A mixed type that includes both { a: string } and { b: string }.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions