Callback function invoked when a union schema cannot match any of its variants. Allows for custom error handling or fallback logic when union validation fails.
The type of the input value
The input value that couldn't be matched
Context information about the field being validated
Custom error or fallback value
const noMatchCallback: UnionNoMatchCallback<unknown> = (value, field) => { throw new Error(`No union variant matched for field ${field.name}`)} Copy
const noMatchCallback: UnionNoMatchCallback<unknown> = (value, field) => { throw new Error(`No union variant matched for field ${field.name}`)}
Callback function invoked when a union schema cannot match any of its variants. Allows for custom error handling or fallback logic when union validation fails.