UNPKG

pure-parse

Version:

Strongly typed validation library that decouples type aliases from validation logic

14 lines (13 loc) 429 B
import { Parser } from './Parser'; /** * Returns a parser that checks whether the data is an instance of the given constructor. * @example * ```ts * const parseError = instanceOf(Error) * parseError(new Error()) // -> Success<Error> * ``` * @param constructor the right-hand side argument of the `instanceof` operator */ export declare const instanceOf: <T>(constructor: { new (...args: never[]): T; }) => Parser<T>;