UNPKG

pure-parse

Version:

Strongly typed validation library that decouples type aliases from validation logic

11 lines (10 loc) 479 B
import { OmitProperty } from '../internals'; /** * A function that returns a [type predicate](https://www.typescriptlang.org/docs/handbook/advanced-types.html#using-type-predicates) on the argument. */ export type Guard<T> = (data: unknown) => data is T; /** * Special guard to check optional values */ export type OptionalGuard<T> = (data: unknown) => data is T | undefined | OmitProperty; export type RequiredGuard<T> = (data: unknown) => data is Exclude<T, OmitProperty>;