A function, taking unknown data as the input and returning a boolean if the
data matches the wanted type. This function must be a type predicate (declaring its return type
as : is T
, where T
is the validated type).
Optional
errorMessage: string | ((data) => string)An optional error message to report if the validation fails. If not provided,
the default error message "Value {input}
is not correct" will be used in error reports.
The
custom
schema allows the user to define its own schema, if it is not present in the library. This schema can then be used like all other primitive schemas (string
,number
, …).Example