Package: effect
Module: Array
A mutable array guaranteed to have at least one element.
When to use
Use when mutation is acceptable and non-emptiness must be tracked at the type level.
Details
This is the mutable counterpart of NonEmptyReadonlyArray. Most Array
module functions return NonEmptyArray when the result is guaranteed
non-empty.
Example (Typing a mutable non-empty array)
import type { Array } from "effect"
const nonEmpty: Array.NonEmptyArray<number> = [1, 2, 3]
nonEmpty.push(4)
See
NonEmptyReadonlyArray — readonly counterpartisArrayNonEmpty — narrow an Array to this typeSignature
type [A, ...A[]] = [A, ...Array<A>]
Since v2.0.0