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

Method referenceKindOf

ark/aot/graph.ts:2353–2379  ·  view source on GitHub ↗
(
		type: TSTypeReference,
		context: TypeContext,
		module: SourceModule,
		kindOfKey: KindOfKey,
		depth: number,
		typeArgs: TypeArgs | undefined,
		state: TypeEvalState
	)

Source from the content-addressed store, hash-verified

2351 // what a named type is: a parameter's constraint, arktype's own Type, a
2352 // local or imported alias, or a container holding what its arguments say
2353 private referenceKindOf(
2354 type: TSTypeReference,
2355 context: TypeContext,
2356 module: SourceModule,
2357 kindOfKey: KindOfKey,
2358 depth: number,
2359 typeArgs: TypeArgs | undefined,
2360 state: TypeEvalState
2361 ): KindBits | undefined {
2362 const name = type.typeName
2363 let root = name
2364 while (root.type === "TSQualifiedName") root = root.left
2365 if (root.type !== "Identifier") return
2366 return this.namedTypeKindOf(
2367 root.name,
2368 name.type === "TSQualifiedName" && name.left === root ? name.right.name
2369 : name.type === "Identifier" ? undefined
2370 : null,
2371 type.typeArguments?.params,
2372 context,
2373 module,
2374 kindOfKey,
2375 depth,
2376 typeArgs,
2377 state
2378 )
2379 }
2380
2381 // qualified: undefined for bare `Foo`, string for `NS.Foo`, null for deeper
2382 private namedTypeKindOf(

Callers 1

typeKindOfMethod · 0.95

Calls 1

namedTypeKindOfMethod · 0.95

Tested by

no test coverage detected