Skip to content

Function.instanceOf

github-actions[bot] edited this page Jul 8, 2026 · 21 revisions

umt / instanceOf

Function: instanceOf()

instanceOf<T>(classConstructor, message?): (value) => ValidateCoreReturnType<T> & StandardSchemaV1<T, T>

Defined in: Validate/instanceof/core.ts:26

Creates a validator that checks whether a value is an instance of the given constructor. Subclasses of the constructor satisfy the validator, matching native instanceof semantics.

Type Parameters

T

T

The instance type produced by the constructor

Parameters

classConstructor

Constructor<T>

Constructor whose instances are accepted

message?

string

Custom error message for validation failure

Returns

(value) => ValidateCoreReturnType<T> & StandardSchemaV1<T, T>

  • Validator function for instances of the constructor

API

Classes

Interfaces

Type Aliases

Variables

Functions

Clone this wiki locally