MCPcopy Create free account
hub / github.com/arktypeio/arktype / issueAt

Function issueAt

ark/schema/shared/issues.ts:684–704  ·  view source on GitHub ↗
(
	path: PropertyKey[],
	site: FailureSite,
	data: unknown,
	key: PropertyKey | undefined
)

Source from the content-addressed store, hash-verified

682type Keyed = Record<PropertyKey, unknown>
683
684export 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
706export const throwOnDefault: Issues.Handler = errors => errors.throw()
707

Callers 3

failsUnionMethod · 0.90
_atMethod · 0.90
runtime.tsFile · 0.50

Calls 1

pathAtFunction · 0.90

Tested by

no test coverage detected