(issue: Filter): string | undefinedCallback type used to format Filter issues into strings.
When to use
Use when customizing how makeFormatterStandardSchemaV1 renders filter failures.
Details
- Returns
stringto override the message, orundefinedto fall back to the default formatting.
Source effect/SchemaIssue.ts:9361 lines
export type type CheckHook = (
issue: Filter
) => string | undefined
Callback type used to format
Filter
issues into strings.
When to use
Use when customizing how
makeFormatterStandardSchemaV1
renders
filter failures.
Details
- Returns
string to override the message, or undefined to fall back to
the default formatting.
CheckHook = (issue: Filter(parameter) issue: {
_tag: 'Filter';
actual: unknown;
filter: SchemaAST.Filter<unknown>;
issue: Issue;
toString: (this: Issue) => string;
}
issue: class Filterclass Filter {
_tag: 'Filter';
actual: unknown;
filter: SchemaAST.Filter<unknown>;
issue: Issue;
toString: (this: Issue) => string;
}
Represents a schema issue produced when a schema filter (refinement check) fails.
When to use
Use when you need to inspect a schema issue that records which refinement
check rejected the value.
Details
actual is the raw input value that was tested (plain unknown, not
wrapped in Option).
filter is the AST filter node that produced this issue.
issue is the inner issue describing the failure reason.
Example (Matching a Filter issue)
import { SchemaIssue } from "effect"
function describe(issue: SchemaIssue.Issue): string {
if (issue._tag === "Filter") {
return `Filter failed on: ${JSON.stringify(issue.actual)}`
}
return String(issue)
}
Filter) => string | undefinedReferenced by 3 symbols