option

function option<T>(subValidator): (x) => x is undefined | T

Create a validator which allows the target to be undefined or satisfy the
sub-validator.

Type parameters

Type parameter
T

Parameters

ParameterType
subValidator(p1) => p1 is T

Returns

Function

A validator for the array type

Parameters

ParameterType
xunknown

Returns

x is undefined | T