types-kit.diff.md

September 4, 2023 ยท View on GitHub

Home > types-kit > Diff

Diff type

Set difference of union and intersection of given union types A and B.

Signature:

export type Diff<A, B> = StrictExclude<A | B, A & B>

References: StrictExclude

Example

// Expect: '2' | '3'
type Foo = Diff<'1' | '2', '1' | '3'>