The union of object types to make exclusive.
The full key set across all members of T.
type Config = ExclusiveUnion<
| { dbConnectionString: string; maxConnections: number }
| { apiEndpoint: string; apiKey: string }
>;
// Result:
// | {
// dbConnectionString: string;
// maxConnections: number;
// apiEndpoint?: never;
// apiKey?: never;
// }
// | {
// dbConnectionString?: never;
// maxConnections?: never;
// apiEndpoint: string;
// apiKey: string;
// }
Constructs a strict exclusive union from a union of object types.
Each member keeps its own properties unchanged, while properties that belong to other union members are added as optional
neverfields.This makes the union mutually exclusive at the type level and is especially useful for configuration objects, variant props, and discriminated unions.