stringEnumValidator

function stringEnumValidator<T>(enumMap): (x) => x is Object extends T ? never : T[keyof T]

Creates a validator which tests if the target is a string
and is one of the values in the specified enum (object).

Type parameters

Type parameter
T

Parameters

ParameterType
enumMapT

Returns

Function

Parameters

ParameterType
xunknown

Returns

x is Object extends T ? never : T[keyof T]