Skip to main content

RequireAtLeastOne<ObjectType, KeysType>

RequireAtLeastOne<ObjectType, KeysType> = { [Key in KeysType]-?: Required<Pick<ObjectType, Key>> & Partial<Pick<ObjectType, Exclude<KeysType, Key>>> }[KeysType] & Except<ObjectType, KeysType>

Defined in: packages/react-querybuilder/src/types/type-fest/require-at-least-one.ts:24

Create a type that requires at least one of the given keys. The remaining keys are kept as is.

Type Parameters

Type ParameterDefault type
ObjectType-
KeysType extends keyof ObjectTypekeyof ObjectType

Example

import type {RequireAtLeastOne} from 'type-fest';

type Responder = {
text?: () => string;
json?: () => string;
secure?: boolean;
};

const responder: RequireAtLeastOne<Responder, 'text' | 'json'> = {
json: () => '{"message": "ok"}',
secure: true
};

caution

API documentation is generated from the latest commit on the main branch. It may be somewhat inconsistent with official releases of React Query Builder.