function isArray
isArray(thing: unknown): thing is unknown[]

Determines if the given value is an array. Acts as a type guard, narrowing the value to unknown[] in branches where the result is true.

Examples

Example 1

isArray([]); // true
isArray([1, 2, 3]); // true
isArray("hello"); // false
isArray(null); // false
isArray({}); // false

Parameters

thing: unknown

Return Type

thing is unknown[]

Usage

import { isArray } from ".";