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

Function checkHeld

ark/type/runtime.ts:1462–1476  ·  view source on GitHub ↗
(
	value: unknown,
	label: string = unnamed,
	kind: "Type" | "Module" | "Scope" | "Generic" = "Type"
)

Source from the content-addressed store, hash-verified

1460
1461// a value holding a cell a validator reads, set only once its site has run
1462export const checkHeld = (
1463 value: unknown,
1464 label: string = unnamed,
1465 kind: "Type" | "Module" | "Scope" | "Generic" = "Type"
1466): void => {
1467 if (value === undefined) {
1468 throwError(
1469 writeCreationMismatchMessage(
1470 label,
1471 describeValue(value),
1472 `the ${kind} it was at build`
1473 )
1474 )
1475 }
1476}
1477
1478// kept off the value so a program can't read it
1479const holesByValue = new WeakMap<

Callers

nothing calls this directly

Calls 3

throwErrorFunction · 0.90
describeValueFunction · 0.85

Tested by

no test coverage detected