object-shape-tester
Version:
Test object properties and value types.
23 lines (22 loc) • 696 B
TypeScript
/**
* Helper type for {@link classShape}.
*
* @category Internal
*/
export type AnyConstructor = new (...args: any[]) => any;
/**
* Creates a shape for a specific class. Value checks are done through `instanceof`.
*
* @category Shape
* @example
*
* ```ts
* import {classShape, checkValidShape} from 'object-shape-tester';
*
* const myShape = classShape(RegExp);
*
* checkValidShape(/hi/, myShape); // `true`
* checkValidShape('hi', myShape); // `false`
* ```
*/
export declare function classShape<T extends AnyConstructor>(classConstructor: T, defaultValue?: InstanceType<T> | undefined): import("../shape/shape.js").Shape<import("@sinclair/typebox").TUnsafe<InstanceType<T>>>;