nullableOption

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

Create a validator which allows the target to be undefined, null, 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 | null | T