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

Function localeExpected

ark/schema/shared/render.ts:184–198  ·  view source on GitHub ↗
(
	error: ArkError,
	cited: string | undefined,
	config: ResolvedConfig,
	locale: Locale.Resolved
)

Source from the content-addressed store, hash-verified

182}
183
184const localeExpected = (
185 error: ArkError,
186 cited: string | undefined,
187 config: ResolvedConfig,
188 locale: Locale.Resolved
189): string => {
190 if (cited !== undefined)
191 return writeKeywordExpected(error as never, locale) ?? locale.cite(cited)
192 const expected = locale[error.code]?.expected
193 if (expected !== undefined) return writeExpected(error, expected, locale)
194 // written whole in en, never as en's frame around the locale's text
195 const inEn = unwrittenError(error)
196 writeInEn(inEn, config, "expected")
197 return inEn.expected
198}
199
200// only the slots its expected reads, so no writer is called twice
201const writeInEn = (

Callers 1

writeFunction · 0.85

Calls 4

writeKeywordExpectedFunction · 0.90
unwrittenErrorFunction · 0.90
writeExpectedFunction · 0.85
writeInEnFunction · 0.85

Tested by

no test coverage detected