devtypes - v2.1.0
    Preparing search index...

    Type Alias RequireExactlyOneFrom<T, K>

    RequireExactlyOneFrom: RequireExactlyOne<Pick<T, K>, K>

    Require exactly one property from a chosen subset of keys.

    Type Parameters

    • T

      Source object type

    • K extends keyof T

      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[] }