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

Method aliasKindOf

ark/aot/graph.ts:4400–4427  ·  view source on GitHub ↗
(
		object: Node,
		name: unknown,
		module: SourceModule,
		kindOfKey: KindOfKey
	)

Source from the content-addressed store, hash-verified

4398 }
4399
4400 private aliasKindOf(
4401 object: Node,
4402 name: unknown,
4403 module: SourceModule,
4404 kindOfKey: KindOfKey
4405 ): KindBits | undefined {
4406 const definition = this.moduleDefinitionOf(object, module, kindOfKey)
4407 const alias = definition && this.aliasIn(definition, name)
4408 // a name it lacks may still be a member written in or inherited
4409 if (!alias) return
4410 if (alias.isGeneric) return kinds.otherArk | kinds.returnsType
4411 const { node, module: valueModule, kindOfKey: valueKindOfKey } = alias.value
4412 if (this.moduleDefinitionOf(node, valueModule, valueKindOfKey))
4413 return kinds.otherArk
4414 const value = unwrapChain(node)
4415 // a definition, which a Scope resolves to a Type
4416 if (
4417 value.type === "Literal" ||
4418 value.type === "TemplateLiteral" ||
4419 value.type === "ObjectExpression" ||
4420 value.type === "ArrayExpression"
4421 )
4422 return kinds.type
4423 // e.g. a Type, but not a Module, Generic or thunk the build can't see into
4424 return isOnlyType(this.transfer(value, valueModule, valueKindOfKey)) ?
4425 kinds.type
4426 : undefined
4427 }
4428
4429 private moduleDefinitionOf(
4430 node: Node,

Callers 2

patternKindOfMethod · 0.95
memberKindInMethod · 0.95

Calls 5

moduleDefinitionOfMethod · 0.95
aliasInMethod · 0.95
transferMethod · 0.95
unwrapChainFunction · 0.90
isOnlyTypeFunction · 0.85

Tested by

no test coverage detected