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

Method typeImportTargetOf

ark/aot/graph.ts:2623–2639  ·  view source on GitHub ↗
(
		name: string,
		module: SourceModule
	)

Source from the content-addressed store, hash-verified

2621
2622 // e.g. the `User` of "./types.ts" for `import type { User } from "./types.ts"`
2623 private typeImportTargetOf(
2624 name: string,
2625 module: SourceModule
2626 ): ImportTarget | undefined {
2627 const imported = importedNameOf(module, name)
2628 if (!imported) return
2629 const [specifier, importedName] = imported
2630 // a type carries no value, so a host asks no bundler to resolve it
2631 const target = this.resolve(specifier, module, () => false)
2632 if (target instanceof SourceModule) {
2633 return importedName === "*" ?
2634 { kind: "namespace", module: target }
2635 : this.exportOf(target, importedName)
2636 }
2637 if (target.kind !== "arktypeNamespace") return
2638 return importedName === "*" ? target : arktypeExportOf(target, importedName)
2639 }
2640
2641 // e.g. `opts: EnvOptions` in index.d.ts for `createEnv(opts)` in index.js,
2642 // which tsc or a bundler wrote beside it, so a package's built output is

Callers 1

queriedOfMethod · 0.95

Calls 4

resolveMethod · 0.95
exportOfMethod · 0.95
arktypeExportOfFunction · 0.85
importedNameOfFunction · 0.70

Tested by

no test coverage detected