Asserts that the input is an array.
An error if the input is not an array.
const fn = (x: unknown) => { assertIsArray(x); // throws an error if x is not an array return x; // x has inferred type Array<unknown>}; Copy
const fn = (x: unknown) => { assertIsArray(x); // throws an error if x is not an array return x; // x has inferred type Array<unknown>};
The input to be asserted.
Asserts that the input is an array.
Throws
An error if the input is not an array.
Example