(u: unknown): u is IssueReturns true if the given value is an Issue.
When to use
Use when you need to narrow an unknown value to Issue in error-handling
code, such as distinguishing an Issue from other error types in a catch-all
handler.
Details
- Checks for the internal
TypeIdbrand on the value.
Example (Type-guarding an unknown error)
import { SchemaIssue } from "effect"
const issue = new SchemaIssue.MissingKey(undefined)
console.log(SchemaIssue.isIssue(issue))
// true
console.log(SchemaIssue.isIssue("not an issue"))
// falseexport function function isIssue(u: unknown): u is IssueReturns true if the given value is an
Issue
.
When to use
Use when you need to narrow an unknown value to Issue in error-handling
code, such as distinguishing an Issue from other error types in a catch-all
handler.
Details
- Checks for the internal
TypeId brand on the value.
Example (Type-guarding an unknown error)
import { SchemaIssue } from "effect"
const issue = new SchemaIssue.MissingKey(undefined)
console.log(SchemaIssue.isIssue(issue))
// true
console.log(SchemaIssue.isIssue("not an issue"))
// false
isIssue(u: unknownu: unknown): u: unknownu is type Issue =
| Leaf
| Filter
| Encoding
| Pointer
| Composite
| AnyOf
The root discriminated union of all validation error nodes.
When to use
Use when typing the error channel in Effect<A, Issue, R> results from
schema parsing, or when writing custom formatters or issue-tree walkers.
Details
Every node has a _tag field for pattern-matching. The union includes both
terminal
Leaf
types and composite types that wrap inner issues:
Filter
,
Encoding
,
Pointer
,
Composite
,
AnyOf
. All Issue instances have a toString() that delegates to
the default formatter, so String(issue) produces a human-readable message.
Issue {
return import hasPropertyhasProperty(u: unknownu, const TypeId: "~effect/SchemaIssue/Issue"TypeId)
}