both

function both<A, B>(validatorA, validatorB): (x) => x is A & B

Create a validator that combines two validators.
This is useful for validating properties that have been composed of a generic and more specific values.

Type parameters

Type parameter
A
B

Parameters

ParameterType
validatorAValidator<A>
validatorBValidator<B>

Returns

Function

Parameters

ParameterType
xunknown

Returns

x is A & B