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

Function checkHelper

ark/type/runtime.ts:1587–1607  ·  view source on GitHub ↗
(
	helper: unknown,
	file: string,
	name: string,
	label: string
)

Source from the content-addressed store, hash-verified

1585
1586// a mock, or a module a test runner replaced, fails
1587export const checkHelper = (
1588 helper: unknown,
1589 file: string,
1590 name: string,
1591 label: string
1592): void => {
1593 const registered = (
1594 Reflect.get(globalThis, helpersKey) as
1595 | Record<string, Record<string, unknown>>
1596 | undefined
1597 )?.[file]
1598 if (!registered || !(name in registered) || registered[name] !== helper) {
1599 throwError(
1600 writeCreationMismatchMessage(
1601 label,
1602 describeValue(helper),
1603 `the function ${file} exports as \`${name}\``
1604 )
1605 )
1606 }
1607}
1608
1609const isValidator = (value: unknown) => value instanceof Validator
1610

Callers

nothing calls this directly

Calls 4

throwErrorFunction · 0.90
describeValueFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected