This type would evaluate to union of "exclusive" shapes.
For example, the following type
type A = ExclusiveUnion<{a: number} | {b: string}>;Evaluates to
type A = { a: number, b?: never } | { a?: never, b: string }| type KeysOfUnion<T> = T extends T ? keyof T : never; | |
| export type ExclusiveUnion<T> = KeysOfUnion<T> extends | |
| infer K extends PropertyKey | |
| ? T extends infer A ? A & Partial<Record<Exclude<K, keyof A>, never>> | |
| : never | |
| : never; |