(
specifier: string,
want: { isDefault: boolean; isNamespace: boolean; exportedName: string; memberName: string | null },
ref: UnresolvedRef,
context: ResolutionContext
)
| 834 | * then the first. |
| 835 | */ |
| 836 | export function findAmbientModuleExport( |
| 837 | specifier: string, |
| 838 | want: { isDefault: boolean; isNamespace: boolean; exportedName: string; memberName: string | null }, |
| 839 | ref: UnresolvedRef, |
| 840 | context: ResolutionContext |
| 841 | ): Node | undefined { |
| 842 | if (want.isNamespace && (!want.memberName || want.memberName.includes('.'))) return undefined; |
| 843 | for (const mod of declarationsFor(specifier, ref.filePath, context)) { |
| 844 | const members = blockMembers(mod, context); |
| 845 | let found: Node[] | undefined; |
| 846 | if (want.isDefault) { |
| 847 | found = mod.defaultName ? members.get(mod.defaultName) : undefined; |
| 848 | } else { |
| 849 | const name = want.isNamespace ? want.memberName! : want.exportedName; |
| 850 | const local = mod.exportAliases.get(name); |
| 851 | // Under an export clause the clause decides; otherwise what the body exports. |
| 852 | found = local !== undefined ? members.get(local) : members.get(name)?.filter((n) => n.isExported); |
| 853 | } |
| 854 | if (found && found.length > 0) { |
| 855 | return [...found].sort((a, b) => kindRank(ref.referenceKind, a.kind) - kindRank(ref.referenceKind, b.kind))[0]; |
| 856 | } |
| 857 | } |
| 858 | return undefined; |
| 859 | } |
| 860 | |
| 861 | /** |
| 862 | * The file node of the declaration file that declares the module `specifier` |
no test coverage detected