function enumValidator<T>(enumMap): (x) => x is Object extends T ? never : T[keyof T]
Creates a validator which tests if the target is a value in the specified enum.
Note that numbers in enums are reverse-mapped by the TS transpiler, so the specified keys are also values.
Type parameters
Type parameter |
---|
T |
Parameters
Parameter | Type |
---|---|
enumMap | T |
Returns
Function
Parameters
Parameter | Type |
---|---|
x | unknown |
Returns
x is Object extends T ? never : T[keyof T]