<N extends number>(n: N): <T>(
self: ReadonlyArray<T>
) => self is TupleOfAtLeast<N, T>
<T, N extends number>(
self: ReadonlyArray<T>,
n: N
): self is TupleOfAtLeast<N, T>Checks whether a readonly array has at least n elements.
When to use
Use when you need a Predicate guard for tuple-like minimum length that
narrows ReadonlyArray<T> to TupleOfAtLeast<N, T>.
Details
This only checks length, not element types, and returns a refinement on the array type.
Example (Checking minimum length)
import { Predicate } from "effect"
const hasAtLeast2 = Predicate.isTupleOfAtLeast(2)
console.log(hasAtLeast2([1, 2, 3]))export const const isTupleOfAtLeast: {
<N extends number>(n: N): <T>(
self: ReadonlyArray<T>
) => self is TupleOfAtLeast<N, T>
<T, N extends number>(
self: ReadonlyArray<T>,
n: N
): self is TupleOfAtLeast<N, T>
}
Checks whether a readonly array has at least n elements.
When to use
Use when you need a Predicate guard for tuple-like minimum length that
narrows ReadonlyArray<T> to TupleOfAtLeast<N, T>.
Details
This only checks length, not element types, and returns a refinement on the
array type.
Example (Checking minimum length)
import { Predicate } from "effect"
const hasAtLeast2 = Predicate.isTupleOfAtLeast(2)
console.log(hasAtLeast2([1, 2, 3]))
isTupleOfAtLeast: {
<function (type parameter) N in <N extends number>(n: N): <T>(self: ReadonlyArray<T>) => self is TupleOfAtLeast<N, T>N extends number>(n: N extends numbern: function (type parameter) N in <N extends number>(n: N): <T>(self: ReadonlyArray<T>) => self is TupleOfAtLeast<N, T>N): <function (type parameter) T in <T>(self: ReadonlyArray<T>): self is TupleOfAtLeast<N, T>T>(self: readonly T[]self: interface ReadonlyArray<T>ReadonlyArray<function (type parameter) T in <T>(self: ReadonlyArray<T>): self is TupleOfAtLeast<N, T>T>) => self: readonly T[]self is type TupleOfAtLeast<N extends number, T> = [...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"]
//
TupleOfAtLeast<function (type parameter) N in <N extends number>(n: N): <T>(self: ReadonlyArray<T>) => self is TupleOfAtLeast<N, T>N, function (type parameter) T in <T>(self: ReadonlyArray<T>): self is TupleOfAtLeast<N, T>T>
<function (type parameter) T in <T, N extends number>(self: ReadonlyArray<T>, n: N): self is TupleOfAtLeast<N, T>T, function (type parameter) N in <T, N extends number>(self: ReadonlyArray<T>, n: N): self is TupleOfAtLeast<N, T>N extends number>(self: readonly T[]self: interface ReadonlyArray<T>ReadonlyArray<function (type parameter) T in <T, N extends number>(self: ReadonlyArray<T>, n: N): self is TupleOfAtLeast<N, T>T>, n: N extends numbern: function (type parameter) N in <T, N extends number>(self: ReadonlyArray<T>, n: N): self is TupleOfAtLeast<N, T>N): self: readonly T[]self is type TupleOfAtLeast<N extends number, T> = [...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"]
//
TupleOfAtLeast<function (type parameter) N in <T, N extends number>(self: ReadonlyArray<T>, n: N): self is TupleOfAtLeast<N, T>N, function (type parameter) T in <T, N extends number>(self: ReadonlyArray<T>, n: N): self is TupleOfAtLeast<N, T>T>
} = import dualdual(2, <function (type parameter) T in <T, N extends number>(self: ReadonlyArray<T>, n: N): self is TupleOfAtLeast<N, T>T, function (type parameter) N in <T, N extends number>(self: ReadonlyArray<T>, n: N): self is TupleOfAtLeast<N, T>N extends number>(self: readonly T[]self: interface ReadonlyArray<T>ReadonlyArray<function (type parameter) T in <T, N extends number>(self: ReadonlyArray<T>, n: N): self is TupleOfAtLeast<N, T>T>, n: N extends numbern: function (type parameter) N in <T, N extends number>(self: ReadonlyArray<T>, n: N): self is TupleOfAtLeast<N, T>N): self: readonly T[]self is type TupleOfAtLeast<N extends number, T> = [...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"]
//
TupleOfAtLeast<function (type parameter) N in <T, N extends number>(self: ReadonlyArray<T>, n: N): self is TupleOfAtLeast<N, T>N, function (type parameter) T in <T, N extends number>(self: ReadonlyArray<T>, n: N): self is TupleOfAtLeast<N, T>T> => self: readonly T[]self.ReadonlyArray<T>.length: numberGets the length of the array. This is a number one higher than the highest element defined in an array.
length >= n: N extends numbern)