Skip to main content

@rbxts/expect > Assertion > arrayOf

Assertion.arrayOf() method

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

Signature:

arrayOf<I>(checker: TypeCheckCallback<I>): Assertion<I[]>;

Parameters

Parameter

Type

Description

checker

TypeCheckCallback<I>

Returns:

Assertion<I[]>

Remarks

Type alias for the array version of this.

Example

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

expect([1,2,3]).to.be.an.arrayOf(isNumber);