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

Function whileResolvingAmbient

ark/schema/scope.ts:1334–1341  ·  view source on GitHub ↗
(name: string, fn: () => t)

Source from the content-addressed store, hash-verified

1332
1333/** calls `fn` with `resolveAmbient(name)` resolving nothing */
1334export const whileResolvingAmbient = <t>(name: string, fn: () => t): t => {
1335 resolvingAmbient.add(name)
1336 try {
1337 return fn()
1338 } finally {
1339 resolvingAmbient.delete(name)
1340 }
1341}
1342
1343/** the root the builtin keyword named resolves to, if any */
1344export const resolveAmbient = (name: string): BaseRoot | undefined => {

Callers 2

bootstrapIntrinsicFunction · 0.90
resolveAmbientFunction · 0.85

Calls 3

fnFunction · 0.50
addMethod · 0.45
deleteMethod · 0.45

Tested by

no test coverage detected