Require all or none of a set of properties.
Source object type
Keys participating in the constraint
1.1.0
Either all specified properties must be present, or none of them.
type Test = { a?: string; b?: number; c: boolean };type Result = RequireAllOrNone< Test, 'a' | 'b' >;// { a: string; b: number; c: boolean } | { c: boolean; a?: never; b?: never; } Copy
type Test = { a?: string; b?: number; c: boolean };type Result = RequireAllOrNone< Test, 'a' | 'b' >;// { a: string; b: number; c: boolean } | { c: boolean; a?: never; b?: never; }
Require all or none of a set of properties.