Require exactly one property from a set.
Source object type
Keys where exactly one must be present (defaults to all keys)
Produces a union of object variants where exactly one of the specified properties is present and all others are explicitly disallowed.
type Test = { a?: string; b?: number; c: boolean };type Result = RequireExactlyOne< Test, 'a' | 'b' >;// { a: string; b?: never; c: boolean } | { a?: never; b: number; c: boolean } Copy
type Test = { a?: string; b?: number; c: boolean };type Result = RequireExactlyOne< Test, 'a' | 'b' >;// { a: string; b?: never; c: boolean } | { a?: never; b: number; c: boolean }
Require exactly one property from a set.