Skip to content

Latest commit

 

History

History
55 lines (39 loc) · 613 Bytes

File metadata and controls

55 lines (39 loc) · 613 Bytes

typelab / utils / UnionExclusive

type UnionExclusive<U1, U2> = Exclude<U1, U2> | Exclude<U2, U1>;

Creates a union of types that are exclusive to each other.

Type Parameters

Type Parameter Description

U1

The first union.

U2

The second union.

Returns

A union of types that excludes common types from both unions.

Example

// 'a' | 'c'
type Exclusive = UnionExclusive<'a' | 'b', 'b' | 'c'>;