UNPKG

tiny-types

Version:

A tiny library that brings Tiny Types to JavaScript and TypeScript

18 lines (17 loc) 495 B
import { Predicate } from './Predicate'; /** * @desc Ensures that the `value` is an instance of `type` * * @example * import { ensure, isInstanceOf, TinyType } from 'tiny-types'; * * class Birthday extends TinyType { * constructor(public readonly value: Date) { * ensure('Date', value, isInstanceOf(Date)); * } * } * * @param {Constructor<T>} type * @returns {Predicate<T>} */ export declare function isInstanceOf<T>(type: new (...args: any[]) => T): Predicate<T>;