MCPcopy Index your code
hub / github.com/arktypeio/arktype / parseInnerDefinition

Function parseInnerDefinition

ark/type/parser/definition.ts:59–75  ·  view source on GitHub ↗
(
	def: unknown,
	ctx: BaseParseContext
)

Source from the content-addressed store, hash-verified

57} = {}
58
59export const parseInnerDefinition = (
60 def: unknown,
61 ctx: BaseParseContext
62): InnerParseResult => {
63 if (typeof def === "string") {
64 if (ctx.args && Object.keys(ctx.args).some(k => def.includes(k))) {
65 // we can only rely on the cache if there are no contextual
66 // resolutions like "this" or generic args
67 return parseString(def, ctx)
68 }
69 const scopeCache = (parseCache[ctx.$.name] ??= {})
70 return (scopeCache[def] ??= parseString(def, ctx))
71 }
72 return hasDomain(def, "object") ?
73 parseObject(def, ctx)
74 : throwParseError(writeBadDefinitionTypeMessage(domainOf(def)))
75}
76
77export const parseObject = (def: object, ctx: BaseParseContext): BaseRoot => {
78 const objectKind = objectKindOf(def)

Callers 2

parsePropertyFunction · 0.90

Calls 6

parseStringFunction · 0.90
hasDomainFunction · 0.90
throwParseErrorFunction · 0.90
domainOfFunction · 0.90
parseObjectFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…