(error: Schema.SchemaError, record: (index: number) => number)
| 583 | // Rewrites the chunk index at the head of each top-level issue path to the |
| 584 | // record number, keeping the rest of the issue unchanged. |
| 585 | const rebaseIssue = (error: Schema.SchemaError, record: (index: number) => number): Schema.SchemaError => { |
| 586 | const issue = error.issue |
| 587 | if (issue._tag !== "Composite") return error |
| 588 | return new Schema.SchemaError( |
| 589 | new SchemaIssue.Composite( |
| 590 | issue.ast, |
| 591 | Arr.map(issue.issues, (issue) => |
| 592 | issue._tag === "Pointer" && typeof issue.path[0] === "number" |
| 593 | ? new SchemaIssue.Pointer([record(issue.path[0]), ...issue.path.slice(1)], issue.issue) |
| 594 | : issue), |
| 595 | issue.input, |
| 596 | { reportInput: "input" in issue } |
| 597 | ) |
| 598 | ) |
| 599 | } |
| 600 | |
| 601 | // Derived codecs are new ASTs, and schema parsers are cached per AST, so they |
| 602 | // are memoized to avoid recompiling parsers for every channel. |
no test coverage detected