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

Function writeText

ark/type/runtime.ts:812–840  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

810 )
811 }
812 const writeText = () => {
813 const error: Record<string, unknown> = {
814 data: issue.data,
815 path: issue.path,
816 ...context,
817 propString: stringifyPath(issue.path)
818 }
819 const write = (writer: Writer, ...args: unknown[]): unknown =>
820 typeof writer === "function" ? writer(...args, enInfo) : writer
821 error.expected = context.expected ?? write(expected, error) ?? text.expected
822 if (context.actual !== undefined) error.actual = context.actual
823 else {
824 if (keeps & 4) describeActual(error)
825 error.actual = write(actual, issue.data, error)
826 }
827 if (keeps & 1) text.expected = error.expected
828 text.message ??=
829 labelsValues && keeps & 8 ?
830 `${issue._n} ${write(message, error)}`
831 : write(message, error)
832 for (const k in text) {
833 defineProperty(issue, k, {
834 value: text[k],
835 writable: true,
836 enumerable: true,
837 configurable: true
838 })
839 }
840 }
841 for (const k in text) {
842 defineProperty(issue, k, {
843 get: () => (writeText(), issue[k as never]),

Callers 1

writeIssueFunction · 0.70

Calls 3

stringifyPathFunction · 0.90
describeActualFunction · 0.85
writeFunction · 0.70

Tested by

no test coverage detected