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

Method definesArk

ark/aot/graph.ts:6228–6252  ·  view source on GitHub ↗
(
		target: Extract<ImportTarget, { kind: "binding" | "expression" }>
	)

Source from the content-addressed store, hash-verified

6226
6227 // e.g. a Type, a literal holding one, or a function returning one
6228 definesArk(
6229 target: Extract<ImportTarget, { kind: "binding" | "expression" }>
6230 ): boolean {
6231 const { module } = target
6232 let fn: readonly [FunctionNode, SourceModule] | undefined
6233 if (target.kind === "binding") {
6234 if (isArk(this.bindingKindOf(target.binding, module))) return true
6235 fn = this.boundFunctionOf(target.binding, module)
6236 } else {
6237 const node = unwrapChain(target.node)
6238 if (isArk(this.kindOf(node, module))) return true
6239 const named = namedFunctionOf(node, module)
6240 if (isFunctionNode(named)) fn = [named, module]
6241 }
6242 const returned = fn && returnedOf(fn[0])
6243 const literal =
6244 this.targetLiteralOf(target, this.finalKindOfKey, new Set()) ??
6245 (fn && returned && this.literalOf(returned, fn[1], this.finalKindOfKey))
6246 const held = literal ? this.heldKindOf(literal) : 0
6247 return (
6248 isArk(held) ||
6249 isFactory(held) ||
6250 (!!fn && isArk(this.finalKindOfKey(...fn)))
6251 )
6252 }
6253}
6254
6255const arktypeExportOf = (

Callers

nothing calls this directly

Calls 12

bindingKindOfMethod · 0.95
boundFunctionOfMethod · 0.95
kindOfMethod · 0.95
targetLiteralOfMethod · 0.95
literalOfMethod · 0.95
heldKindOfMethod · 0.95
unwrapChainFunction · 0.90
namedFunctionOfFunction · 0.85
isFunctionNodeFunction · 0.85
isArkFunction · 0.70
returnedOfFunction · 0.70
isFactoryFunction · 0.70

Tested by

no test coverage detected