Skip to content

Function.tuple

github-actions[bot] edited this page Nov 18, 2026 · 13 revisions

umt / tuple

Function: tuple()

tuple<Vs>(validators, message?): ((values) => ValidateCoreReturnType<TupleInfer<Vs>>) & StandardSchemaV1<TupleInfer<Vs>, TupleInfer<Vs>>

Defined in: Validate/array/tuple.ts:36

Creates a tuple validator for fixed-length arrays whose elements are validated position by position with their own validator

Type Parameters

Vs

Vs extends readonly TupleElementValidator[]

The tuple of validators, one per position (each return type field carries the element type)

Parameters

validators

Vs

Validators applied to the element at the same index

message?

string = ""

Custom error message when the value is not an array or its length differs from the number of validators

Returns

((values) => ValidateCoreReturnType<TupleInfer<Vs>>) & StandardSchemaV1<TupleInfer<Vs>, TupleInfer<Vs>>

  • Validator function for arrays of exactly validators.length elements that satisfy the validator at their index

API

Classes

Interfaces

Type Aliases

Variables

Functions

Clone this wiki locally