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

Method parseOwnDefinitionFormat

ark/type/scope.ts:287–305  ·  view source on GitHub ↗
(def: unknown, ctx: BaseParseContext)

Source from the content-addressed store, hash-verified

285 }
286
287 parseOwnDefinitionFormat(def: unknown, ctx: BaseParseContext): BaseRoot {
288 const isScopeAlias = ctx.alias && ctx.alias in this.aliases
289
290 // if the definition being parsed is not a scope alias and is not a
291 // generic instantiation (i.e. opts don't include args), add `this` as a resolution.
292
293 // if we're parsing a nested string, ctx.args will have already been set
294 if (!isScopeAlias && !ctx.args) ctx.args = { this: ctx.id }
295
296 const result = parseInnerDefinition(def, ctx)
297
298 if (isArray(result)) {
299 if (result[1] === "=") return throwParseError(shallowDefaultableMessage)
300
301 if (result[1] === "?") return throwParseError(shallowOptionalMessage)
302 }
303
304 return result
305 }
306
307 unit: UnitTypeParser<$> = value => this.units([value]) as never
308

Callers 8

parsePropertyFunction · 0.45
parseKeyOfTupleFunction · 0.45
parseBranchTupleFunction · 0.45
parseArrayTupleFunction · 0.45
parseMorphTupleFunction · 0.45
parseNarrowTupleFunction · 0.45
parseMetaTupleFunction · 0.45
parseObjectLiteralFunction · 0.45

Calls 2

parseInnerDefinitionFunction · 0.90
throwParseErrorFunction · 0.90

Tested by

no test coverage detected