Require exactly one property from a chosen subset of keys.
Source object type
Keys where exactly one must be present
Applies a mutually exclusive constraint to a selected subset of fields without carrying the remaining properties from the source type. This is useful when the source type includes additional fields that should not be part of the exact-one union.
type Result = RequireExactlyOneFrom< { value?: string; values?: string[]; range?: number; }, 'value' | 'values'>;// { value: string; values?: never } | { value?: never; values: string[] } Copy
type Result = RequireExactlyOneFrom< { value?: string; values?: string[]; range?: number; }, 'value' | 'values'>;// { value: string; values?: never } | { value?: never; values: string[] }
Require exactly one property from a chosen subset of keys.