Package: effect
Module: Array
A readonly array guaranteed to have at least one element.
When to use
Use when non-emptiness must be tracked at the type level while preventing mutation. Many Array module functions accept or return this type.
Example (Typing a non-empty array)
import type { Array } from "effect"
const nonEmpty: Array.NonEmptyReadonlyArray<number> = [1, 2, 3]
const head: number = nonEmpty[0] // guaranteed to exist
See
NonEmptyArray — mutable counterpartisReadonlyArrayNonEmpty — narrow a ReadonlyArray to this typeSignature
type readonly [A, ...A[]] = readonly [A, ...Array<A>]
Since v2.0.0