Optional__Enforces T is in an invariant position. This prevents a validator with more strict rules is assigned to a less strict type, which can cause unexpected validation errors.
ReadonlyassertValidates the given input, asserting that the input is type T.
If the input is not valid, a ValidationError will be thrown.
The input to validate.
Optionalorigin: stringThe error origin. ErrorOrigin.API by default.
Optionalpath: readonly string[]The current field path to this validator.
Returns the input, cast as the validated type T
ReadonlydescriptionA short description of the validator.
ReadonlyisReturns true if the input is valid according to this validator.
ReadonlyvalidateValidates the provided input, returning a list of error messages, or an empty array if the input passes this validator.
The input to validate.
Optionaloptions: ValidationOptionsValidation options.
Optionalpath: readonly string[]The current field path to this validator.
Returns an array of validation failures. If options.all is not true, only the
first error will be returned.
A Validator can assert that an input matches this validator's schema.