Skip to main content

@rbxts/expect > Assertion > instanceOf

Assertion.instanceOf() method

Asserts that the value is an instance of type typeName.

Signature:

instanceOf<I extends keyof CheckableTypes>(name: I): Assertion<I>;

Parameters

Parameter

Type

Description

name

I

Returns:

Assertion<I>

Remarks

The type is checked via typeOf.

Example

expect(1).to.be.an.instanceOf("number");
expect(new Vector3()).to.be.an.instanceOf("Vector3");