UNPKG

guardz

Version:

A simple and lightweight TypeScript type guard library for runtime type validation.

13 lines (12 loc) 656 B
import type { TypeGuardFn } from './isType'; /** * Creates a type guard that checks if a value is an object that contains * at least the selected subset of properties (picked keys) from a type. * * Notes: * - This utility is designed to be composed with a full object type guard * (e.g., from `isType`/`isSchema`). It ensures the specified keys exist. * - Validation of the picked properties' value types should be ensured by the * provided base type guard if you call it beforehand or compose it externally. */ export declare function isPick<T, K extends keyof T>(_baseTypeGuard: TypeGuardFn<T>, ...pickedKeys: K[]): TypeGuardFn<Pick<T, K>>;