effect-io-ai

Package: effect
Module: Types

Types.TupleOfAtLeast

Constructs a tuple type with at least N elements of type T.

When to use

Use when you need a minimum-length array type that still allows additional elements. This is useful for variadic function signatures that require a minimum arity.

Details

Produces a tuple with N fixed positions followed by ...Array<T>.

Example (Checking minimum-length tuples)

import type { Types } from "effect"

// At least 2 strings
const ok1: Types.TupleOfAtLeast<2, string> = ["a", "b"]
const ok2: Types.TupleOfAtLeast<2, string> = ["a", "b", "c", "d"]

// @ts-expect-error - too few elements
const bad: Types.TupleOfAtLeast<2, string> = ["a"]

See

Signature

type [...TupleOf<N, T>, ...T[]] = [...TupleOf<N, T>, ...Array<T>]

Source

Since v3.3.0