MCPcopy
hub / github.com/arktypeio/arktype / bindReference

Function bindReference

ark/schema/scope.ts:466–496  ·  view source on GitHub ↗
(
		reference: reference
	)

Source from the content-addressed store, hash-verified

464 }
465
466 bindReference<reference extends BaseNode | GenericRoot>(
467 reference: reference
468 ): reference {
469 let bound: reference
470
471 if (isNode(reference)) {
472 bound =
473 reference.$ === this ?
474 reference
475 : new (reference.constructor as any)(reference.attachments, this)
476 } else {
477 bound =
478 reference.$ === this ?
479 reference
480 : (new GenericRoot(
481 reference.params as never,
482 reference.bodyDef,
483 reference.$,
484 this as never,
485 reference.hkt
486 ) as never)
487 }
488
489 if (!this.resolved) {
490 // we're still parsing the scope itself, so defer compilation but
491 // add the node as a reference
492 Object.assign(this.referencesById, bound.referencesById)
493 }
494
495 return bound as never
496 }
497
498 resolveRoot(name: string): BaseRoot {
499 return (

Callers

nothing calls this directly

Calls 1

isNodeFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…