Skip to content

Variable: isInstanceOf()

ts
const isInstanceOf: <T>(
  value: unknown,
  type: string,
  ctor?: (...args: any[]) => T,
) => value is T;

Checks if a value is an instance of a specific class.

Type Parameters

Type Parameter
T

Parameters

ParameterTypeDescription
valueunknownThe value to check
typestringThe name of the class to check against
ctor?(...args: any[]) => T-

Returns

value is T

true if the value is an instance of the specified class, false otherwise