FilterOutputThe value a filter predicate (see makeFilter) may return.
Details
Each shape is normalized into an SchemaIssue.Issue (or undefined for
success) before being attached to the parse result:
undefined: success. The input satisfies the filter.true: success. Equivalent toundefined, useful when the predicate is a plain boolean expression.false: generic failure. Produces an SchemaIssue.InvalidValue wrapping the input, with no custom message.- FilterIssue: a single failure. See FilterIssue for the
shapes (
string, SchemaIssue.Issue, or{ path, issue }). ReadonlyArray<FilterIssue>: several failures reported together. An empty array is treated as success; a single-element array is equivalent to returning that element directly; otherwise the entries are grouped into an SchemaIssue.Composite.
export type type FilterOutput =
| boolean
| FilterIssue
| readonly FilterIssue[]
| undefined
The value a filter predicate (see
makeFilter
) may return.
Details
Each shape is normalized into an
SchemaIssue.Issue
(or undefined for
success) before being attached to the parse result:
undefined: success. The input satisfies the filter.
true: success. Equivalent to undefined, useful when the predicate is
a plain boolean expression.
false: generic failure. Produces an
SchemaIssue.InvalidValue
wrapping
the input, with no custom message.
FilterIssue
: a single failure. See
FilterIssue
for the
shapes (string,
SchemaIssue.Issue
, or { path, issue }).
ReadonlyArray<FilterIssue>: several failures reported together. An
empty array is treated as success; a single-element array is equivalent
to returning that element directly; otherwise the entries are grouped
into an
SchemaIssue.Composite
.
FilterOutput =
| undefined
| boolean
| type FilterIssue =
| string
| SchemaIssue.Issue
| {
readonly path: ReadonlyArray<PropertyKey>
readonly issue: string | SchemaIssue.Issue
}
A single failure reported by a filter predicate. Used as the element type
of the array arm of
FilterOutput
, and also accepted on its own.
Details
string: failure with that string as the message. Produces an
SchemaIssue.InvalidValue
wrapping the input, with the string used as
the issue's message annotation.
SchemaIssue.Issue
: a fully-formed issue, returned as-is.
{ path, issue }: failure attached to a nested path. issue is either
a string (wrapped in an
SchemaIssue.InvalidValue
) or a full
SchemaIssue.Issue
; the result is wrapped in an
SchemaIssue.Pointer
at the given path.
FilterIssue
| interface ReadonlyArray<T>ReadonlyArray<type FilterIssue =
| string
| SchemaIssue.Issue
| {
readonly path: ReadonlyArray<PropertyKey>
readonly issue: string | SchemaIssue.Issue
}
A single failure reported by a filter predicate. Used as the element type
of the array arm of
FilterOutput
, and also accepted on its own.
Details
string: failure with that string as the message. Produces an
SchemaIssue.InvalidValue
wrapping the input, with the string used as
the issue's message annotation.
SchemaIssue.Issue
: a fully-formed issue, returned as-is.
{ path, issue }: failure attached to a nested path. issue is either
a string (wrapped in an
SchemaIssue.InvalidValue
) or a full
SchemaIssue.Issue
; the result is wrapped in an
SchemaIssue.Pointer
at the given path.
FilterIssue>