Skip to main content
Module

x/scaffold/src/deps/types.ts>RequireAtLeastOne

scaffold your next project with style and 💗
Latest
type alias RequireAtLeastOne
import { type RequireAtLeastOne } from "https://deno.land/x/scaffold@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

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

ObjectType
optional
KeysType extends keyof ObjectType = keyof ObjectType
definition: [Key in KeysType]-?: Required<Pick<ObjectType, Key>> & Partial<Pick<ObjectType, Exclude<KeysType, Key>>>[KeysType] & Except<ObjectType, KeysType>