End<A, L>Tuple returned when a Sink finishes.
Details
The first element is the sink result. The optional second element contains a non-empty array of leftover input that was pulled but not consumed.
models
Source effect/Sink.ts:891 lines
export type type End<A, L = never> = readonly [
value: A,
leftover?: readonly [L, ...L[]] | undefined
]
Tuple returned when a Sink finishes.
Details
The first element is the sink result. The optional second element contains a
non-empty array of leftover input that was pulled but not consumed.
End<function (type parameter) A in type End<A, L = never>A, function (type parameter) L in type End<A, L = never>L = never> = readonly [Avalue: function (type parameter) A in type End<A, L = never>A, readonly [L, ...L[]] | undefinedleftover?: type NonEmptyReadonlyArray<A> = readonly [A, ...A[]]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
NonEmptyReadonlyArray<function (type parameter) L in type End<A, L = never>L> | undefined]Referenced by 15 symbols