Skip to content

allOf

allOf<T>(…arbitraries): Dependent<UnionToIntersection<TypeOfArbitraries<T>>>

It takes an arbitrary number of arbitraries, and returns an arbitrary that generates objects that are the result of merging all the objects generated by the input arbitraries.

Example

random(allOf(object({foo: string()}), object({bar: string()})))
// => {foo: "bar", bar: "foo"}

Type Parameters

T extends Arbitrary<Record<PropertyKey, unknown>>[]

Parameters

arbitraries

…[...T[]]

The arbitraries to merge.

Returns

Dependent<UnionToIntersection<TypeOfArbitraries<T>>>

An arbitrary that generates a record of all the properties of the given arbitraries.