Skip to content

ValueVerdict

type ValueVerdict =
| {
valid: true;
}
| {
coerced: unknown;
}
| {
invalid: {
code: string;
message: string;
path?: string;
};
};

What the validate function of a facet returns for a value that already conforms to the schema. It is { valid: true } when the value is acceptable, { coerced: value } when another value must be kept instead, and { invalid: { code, message, path? } } when the value is refused. The functions valid(), coerced(value) and invalid(issue) of the SDK build these objects.