( name: string, context: TypeContext, module: SourceModule, kindOfKey: KindOfKey )
| 2590 | // declares one: a binding, or what a type-only import names, which the |
| 2591 | // module's scopes don't bind |
| 2592 | private queriedOf( |
| 2593 | name: string, |
| 2594 | context: TypeContext, |
| 2595 | module: SourceModule, |
| 2596 | kindOfKey: KindOfKey |
| 2597 | ): [kind: KindBits, value: Located | undefined] | undefined { |
| 2598 | const binding = module.scopes.bindingIn(contextNodeOf(context), name) |
| 2599 | const target = |
| 2600 | binding ? |
| 2601 | binding.kind === "import" ? |
| 2602 | this.importOf(binding, module) |
| 2603 | : { kind: "binding" as const, module, binding, name } |
| 2604 | : this.typeImportTargetOf(name, module) |
| 2605 | if (!target) return |
| 2606 | const declaration = |
| 2607 | target.kind === "binding" ? target.binding.declaration : undefined |
| 2608 | const value: Located | undefined = |
| 2609 | target.kind === "expression" ? |
| 2610 | { node: target.node, module: target.module, kindOfKey } |
| 2611 | : ( |
| 2612 | target.kind === "binding" && |
| 2613 | declaration?.type === "VariableDeclarator" && |
| 2614 | declaration.id === target.binding.id && |
| 2615 | declaration.init |
| 2616 | ) ? |
| 2617 | { node: declaration.init, module: target.module, kindOfKey } |
| 2618 | : undefined |
| 2619 | return [this.targetKindOf(target, kindOfKey), value] |
| 2620 | } |
| 2621 | |
| 2622 | // e.g. the `User` of "./types.ts" for `import type { User } from "./types.ts"` |
| 2623 | private typeImportTargetOf( |
no test coverage detected