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

Function assertKeepsReportKeys

ark/type/standalone/sites.ts:86–104  ·  view source on GitHub ↗
(root: BaseRoot)

Source from the content-addressed store, hash-verified

84// a key a narrow or morph passes its ctx's reject() or error(), which arktype's
85// error keeps, would be on it in development and gone from it in production
86const assertKeepsReportKeys = (root: BaseRoot): void => {
87 for (const unit of rootUnitsOf(root)) {
88 for (const node of unit.declared) {
89 const fns =
90 node.is("predicate") ? [node.predicate]
91 : node.is("morph") ? node.morphs
92 : []
93 for (const fn of fns) {
94 const dropped =
95 typeof fn === "function" ? dropsReportKeys.get(fn) : undefined
96 if (dropped) {
97 throwParseError(
98 writeUnprecompilableMessage(writeDroppedKeys(fn, dropped))
99 )
100 }
101 }
102 }
103 }
104}
105
106const listed = (items: readonly string[]): string =>
107 items.length > 1 ?

Callers 1

assertDescribedFunction · 0.85

Calls 6

rootUnitsOfFunction · 0.90
throwParseErrorFunction · 0.90
writeDroppedKeysFunction · 0.85
isMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected