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

Function writeInEn

ark/schema/shared/render.ts:201–218  ·  view source on GitHub ↗
(
	error: ArkError,
	config: ResolvedConfig,
	last: "expected" | "actual"
)

Source from the content-addressed store, hash-verified

199
200// only the slots its expected reads, so no writer is called twice
201const writeInEn = (
202 error: ArkError,
203 config: ResolvedConfig,
204 last: "expected" | "actual"
205): void => {
206 // a union's expected reads its children's actual
207 if (error.code === "union")
208 for (const e of error.errors) writeInEn(e, config, "actual")
209 error.propString ??= stringifyPath(error.path)
210 const expected = configOf(error, "expected", config)
211 error.expected ??= writeExpected(error, expected as never, defaultLocale)
212 if (last === "expected") return
213 error.actual ??= writeActual(
214 error,
215 configOf(error, "actual", config) as never,
216 defaultLocale
217 )
218}
219
220const writeExpected = (
221 error: ArkError,

Callers 1

localeExpectedFunction · 0.85

Calls 4

stringifyPathFunction · 0.90
writeActualFunction · 0.90
writeExpectedFunction · 0.85
configOfFunction · 0.70

Tested by

no test coverage detected