keyof()
keyof<
T>(objectSchema,message?):KeyofSchema<ObjectSchema<T>>
Keyof schema - validates that the value is a key of an object.
Type Parametersβ
T: T extends Record<string, GenericSchema>β
Parametersβ
objectSchema: ObjectSchema<T> | ObjectConstraint<T> | { entries: T; }β
Object schema whose keys to validate.
message?: stringβ
Custom error message.
Returns: KeyofSchema<ObjectSchema<T>>β
Schema that validates the object keys.
Sinceβ
2.0.0