Hyperlinkv0.8.0-beta.28

Array

Array.isArrayconsteffect/Array.ts:797
(self: unknown): self is Array<unknown>
<T>(self: T): self is Extract<T, ReadonlyArray<any>>

Checks whether a value is an Array.

When to use

Use to verify a value is a mutable array, narrowing its type to Array<unknown>.

Details

Acts as a type guard narrowing the input to Array<unknown> and delegates to globalThis.Array.isArray.

Example (Type-guarding an unknown value)

import { Array } from "effect"

console.log(Array.isArray(null)) // false
console.log(Array.isArray([1, 2, 3])) // true
Source effect/Array.ts:7974 lines
export const isArray: {
  (self: unknown): self is Array<unknown>
  <T>(self: T): self is Extract<T, ReadonlyArray<any>>
} = Array.isArray
Referenced by 1 symbols