Skip to main content

@rbxts/expect > Assertion > instanceOf

Assertion.instanceOf() method

Asserts that the value is an instance of I, according to a custom callback TypeCheckCallback.

Signature:

instanceOf<I>(checker: TypeCheckCallback<T>): Assertion<I>;

Parameters

Parameter

Type

Description

checker

TypeCheckCallback<T>

Returns:

Assertion<I>

Example

const isNumber: TypeCheckCallback = (value) => {
return typeOf(value) === "number";
}

expect(1).to.be.an.instanceOf(isNumber);