Skip to main content

@rbxts/expect > Assertion > typeOf

Assertion.typeOf() method

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

Signature:

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

Parameters

Parameter

Type

Description

checker

TypeCheckCallback<T>

Returns:

Assertion<I>

Remarks

Type alias for the instanceOf version of this.

Example

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

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