tiny-types
Version:
A tiny library that brings Tiny Types to JavaScript and TypeScript
18 lines (17 loc) • 588 B
TypeScript
import { Predicate } from './Predicate';
/**
* @desc Ensures that the `value` meets all the provided {@link Predicate}s.
*
* @example
* import { and, ensure, isDefined, isGreaterThan, isInteger, TinyType } from 'tiny-types';
*
* class AgeInYears extends TinyType {
* constructor(public readonly value: number) {
* ensure('AgeInYears', value, and(isDefined(), isInteger(), isGreaterThan(18));
* }
* }
*
* @param {...Array<Predicate<T>>} predicates
* @returns {Predicate<T>}
*/
export declare function and<T>(...predicates: Array<Predicate<T>>): Predicate<T>;