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

Function maybeResolveSubalias

ark/schema/scope.ts:610–623  ·  view source on GitHub ↗

If name is a valid reference to a submodule alias, return its resolution

(
		name: string
	)

Source from the content-addressed store, hash-verified

608
609 /** If name is a valid reference to a submodule alias, return its resolution */
610 protected maybeResolveSubalias(
611 name: string
612 ): BaseRoot | GenericRoot | undefined {
613 const resolution =
614 (this._lazy && maybeResolveExport(this._lazy, name)) ??
615 maybeResolveSubalias(this.aliases, name)
616 if (resolution) return resolution
617 // an alias shadows the keyword of its name, including what only the
618 // keyword's submodule holds
619 const dotIndex = name.indexOf(".")
620 if (dotIndex !== -1 && hasOwn(this.aliases, name.slice(0, dotIndex))) return
621 const keyword = maybeResolveSubalias(this.ambient, name)
622 return keyword && this.holdAmbient(name, this.bindKw(keyword))
623 }
624
625 // an ambient module can be another scope's, read lazily, whose alias a
626 // check still waiting could fail or leave unchecked, so what this scope

Callers 1

resolveAmbientFunction · 0.85

Calls 9

hasOwnFunction · 0.90
hasArkKindFunction · 0.90
throwParseErrorFunction · 0.90
throwInternalErrorFunction · 0.90
printableFunction · 0.90
maybeResolveExportFunction · 0.85
isPrivateKeyFunction · 0.85

Tested by

no test coverage detected