Hyperlinkv0.8.0-beta.28

Types

Types.TupleOfAtLeasttypeeffect/Types.ts:87
[...TupleOf<N, T>, ...T[]]

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"]
tuplesTupleOf
Source effect/Types.ts:871 lines
export type TupleOfAtLeast<N extends number, T> = [...TupleOf<N, T>, ...Array<T>]
Referenced by 2 symbols