( path: PropertyKey[], site: FailureSite, data: unknown, key: PropertyKey | undefined )
| 682 | type Keyed = Record<PropertyKey, unknown> |
| 683 | |
| 684 | export const issueAt = ( |
| 685 | path: PropertyKey[], |
| 686 | site: FailureSite, |
| 687 | data: unknown, |
| 688 | key: PropertyKey | undefined |
| 689 | ): ArkIssue => { |
| 690 | let context = site.v ?? (site as SiteContext) |
| 691 | if (key !== undefined) { |
| 692 | if (site.m && !(key in (data as object))) context = site.m |
| 693 | else data = (data as Keyed)[key] |
| 694 | } |
| 695 | const issue: ArkIssue = { |
| 696 | code: context.code, |
| 697 | path: pathAt(path, key), |
| 698 | data, |
| 699 | expected: context.description, |
| 700 | message: context.x |
| 701 | } |
| 702 | if (callsSiteText) context.text?.(issue) |
| 703 | return issue |
| 704 | } |
| 705 | |
| 706 | export const throwOnDefault: Issues.Handler = errors => errors.throw() |
| 707 |
no test coverage detected