UNPKG

tiny-types

Version:

A tiny library that brings Tiny Types to JavaScript and TypeScript

20 lines (19 loc) 540 B
import { Predicate } from './Predicate'; /** * @desc Ensures that the `value` is equal to one of the `allowedValues` * * @example * import { ensure, isOneOf, TinyType } from 'tiny-types'; * * class StreetLight extends TinyType { * constructor(public readonly value: string) { * super(); * * ensure('StreetLight', value, isOneOf('red', 'yellow', 'green')); * } * } * * @param {...T[]} allowedValues * @returns {Predicate<T>} */ export declare function isOneOf<T>(...allowedValues: T[]): Predicate<T>;