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

Method parseOwn

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

Source from the content-addressed store, hash-verified

652 }
653
654 parseOwn(def: unknown, ctx: BaseParseContext): BaseRoot {
655 const isScopeAlias = ctx.alias && ctx.alias in this.aliases
656
657 // if the definition being parsed is not a scope alias and is not a
658 // generic instantiation (i.e. opts don't include args), add `this` as a resolution.
659
660 // if we're parsing a nested string, ctx.args will have already been set
661 if (!isScopeAlias && !ctx.args) ctx.args = { this: ctx.id }
662
663 const result = parseInnerDefinition(def, ctx)
664
665 if (isArray(result)) {
666 if (result[1] === "=") return throwParseError(shallowDefaultableMessage)
667
668 if (result[1] === "?") return throwParseError(shallowOptionalMessage)
669 }
670
671 return result
672 }
673
674 unit: UnitTypeParser<$> = value => this.units([value]) as never
675

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