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

Function resolveAmbient

ark/schema/scope.ts:1344–1359  ·  view source on GitHub ↗
(name: string)

Source from the content-addressed store, hash-verified

1342
1343/** the root the builtin keyword named resolves to, if any */
1344export const resolveAmbient = (name: string): BaseRoot | undefined => {
1345 // writing the keyword's own expression asks for it while this resolves it
1346 if (resolvingAmbient.has(name)) return
1347 return whileResolvingAmbient(name, () => {
1348 const ambient: InternalModule = $ark.ambient as never
1349 const resolution =
1350 hasOwn(ambient, name) ?
1351 ambient[name]
1352 : maybeResolveSubalias(ambient, name)
1353 return (
1354 hasArkKind(resolution, "module") ? resolution.root
1355 : hasArkKind(resolution, "root") ? resolution
1356 : undefined
1357 )
1358 })
1359}
1360
1361ambientResolver.resolve = resolveAmbient
1362

Callers

nothing calls this directly

Calls 5

hasOwnFunction · 0.90
hasArkKindFunction · 0.90
whileResolvingAmbientFunction · 0.85
maybeResolveSubaliasFunction · 0.85
hasMethod · 0.45

Tested by

no test coverage detected