effect-io-ai

Package: effect
Module: Tuple

Tuple.appendElement

Appends a single element to the end of a tuple.

When to use

Use when you need the appended value to remain part of the tuple’s type-level shape and preserve literal element positions.

Details

The result type is [...T, E], preserving all existing element types.

Example (Appending an element)

import { pipe, Tuple } from "effect"

const result = pipe(Tuple.make(1, 2), Tuple.appendElement("end"))
console.log(result) // [1, 2, "end"]

See

Signature

declare const appendElement: { <const E>(element: E): <const T extends ReadonlyArray<unknown>>(self: T) => [...T, E]; <const T extends ReadonlyArray<unknown>, const E>(self: T, element: E): [...T, E]; }

Source

Since v2.0.0