Skip to content

Variable: isArray

const isArray: typeof Array.isArray = Array.isArray

Type guard to check if a value is an array. This is a re-export of Array.isArray for consistency with other type guards.

Param

The value to check

Returns

True if the value is an array

Example

typescript
const value: unknown = [1, 2, 3]

if (isArray(value)) {
  // TypeScript knows value is an array
  console.log(value.length) // 3
}

Released under the MIT License.