tiny-types
Version:
A tiny library that brings Tiny Types to JavaScript and TypeScript
18 lines (17 loc) • 564 B
TypeScript
import { Predicate } from './Predicate';
/**
* @desc Ensures that the `property` of the `value` meets the `predicates`
*
* @example
* import { ensure, isGreaterThan, property, TinyType } from 'tiny-types';
*
* class Name extends TinyType {
* constructor(public readonly value: string) {
* super();
* ensure('Name', value, property('length', isGreaterThan(3)));
* }
* }
*
* @returns {Predicate<T>}
*/
export declare function property<T, K extends keyof T>(propertyName: K, ...predicates: Array<Predicate<T[K]>>): Predicate<T>;