Skip to content

tuple

tuple<T>(…xs): Dependent<{ [K in keyof T]: TypeOfArbitrary<T[K]> }>

It takes an arbitrary number of arbitraries and returns a new arbitrary that generates tuples of the values generated by the input arbitraries.

Example

random(tuple(integer(), integer()))
// => [921604357, 511147728]
random(tuple(integer(), integer()))
// => [922310816, 522685001]

Type Parameters

T extends Arbitrary<unknown>[]

Parameters

xs

…[...T[]]

The array of arbitraries to interleave.

Returns

Dependent<{ [K in keyof T]: TypeOfArbitrary<T[K]> }>

A dependent arbitrary that is a tuple of the values of the arbitraries passed in.