tiny-types
Version:
A tiny library that brings Tiny Types to JavaScript and TypeScript
18 lines (17 loc) • 601 B
TypeScript
import { Predicate } from './Predicate';
/**
* @desc Ensures that the `value` meets at least one of the provided {@link Predicate}s.
*
* @example
* import { ensure, isEqualTo, isGreaterThan, isLessThan, or } from 'tiny-type'l
*
* class Percentage extends TinyType {
* constructor(public readonly value: number) {
* ensure('Percentage', value, or(isEqualTo(0), isGreaterThan(0)), or(isLessThan(100), isEqualTo(100));
* }
* }
*
* @param {Predicate<T>} predicates
* @returns {Predicate<T>}
*/
export declare function or<T>(...predicates: Array<Predicate<T>>): Predicate<T>;