@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 |
Returns:
Assertion<I>
Example
const isNumber: TypeCheckCallback = (value) => {
return typeOf(value) === "number";
}
expect(1).to.be.an.instanceOf(isNumber);