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

Function labelOfValue

ark/schema/shared/errors.ts:1366–1382  ·  view source on GitHub ↗
(error: ArkError)

Source from the content-addressed store, hash-verified

1364 * discriminant misses isn't the value its meta is about
1365 */
1366const labelOfValue = (error: ArkError): string | undefined => {
1367 switch (error.code) {
1368 case "required":
1369 return error.valueMeta.label
1370 case "undeclared":
1371 return
1372 case "discriminant":
1373 return error.onKey ? undefined : error.meta?.label
1374 case "union": {
1375 if (listsErrors(error)) return
1376 const bases = basesByUnion.get(error)
1377 return bases ? labelSharedBy(bases) : error.meta?.label
1378 }
1379 default:
1380 return error.meta?.label
1381 }
1382}
1383
1384/**
1385 * an error's actual, noting one that describes its data, which en's messages

Callers 1

labelMessageFunction · 0.85

Calls 3

listsErrorsFunction · 0.90
labelSharedByFunction · 0.90
getMethod · 0.65

Tested by

no test coverage detected