import { type RequireAtLeastOne } from "https://deno.land/x/actionify@0.3.0/src/deps/types.ts";
Create a type that requires at least one of the given keys. The remaining keys are kept as is.
Examples
Example 1
Example 1
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
};
Type Parameters
optional
KeysType extends keyof ObjectType = keyof ObjectTypedefinition: [Key in KeysType]-?: Required<Pick<ObjectType, Key>> & Partial<Pick<ObjectType, Exclude<KeysType, Key>>>[KeysType] & Except<ObjectType, KeysType>