Skip to content

object

object<T>(properties): Dependent<{ [K in keyof T]: T[K] extends { value: any } ? Value : never }>

It takes an object of arbitraries and returns an arbitrary of an object of values.

Example

random(object({foo: integer()}))
// => {foo: 921604357}
random(object({foo: integer()}))
// => {foo: 511147728}

Type Parameters

T extends Record<PropertyKey, Arbitrary<unknown>>

Parameters

properties

T

The properties of the arbitrary.

Returns

Dependent<{ [K in keyof T]: T[K] extends { value: any } ? Value : never }>

An object with the same keys as the input object, but with the values being the return value of the value function of the input object.