Fixes searches for symbols exported using export * as (#39507)

Fixes #39006
This commit is contained in:
Sheetal Nandi
2020-07-08 13:31:21 -07:00
committed by GitHub
parent ebac7ec08f
commit 0f86c04af3
2 changed files with 20 additions and 0 deletions

View File

@@ -122,6 +122,10 @@ namespace ts.FindAllReferences {
// This is `export * from "foo"`, so imports of this module may import the export too.
handleDirectImports(getContainingModuleSymbol(direct, checker));
}
else if (direct.exportClause.kind === SyntaxKind.NamespaceExport) {
// `export * as foo from "foo"` add to indirect uses
addIndirectUsers(getSourceFileLikeForImportDeclaration(direct));
}
else {
// This is `export { foo } from "foo"` and creates an alias symbol, so recursive search will get handle re-exports.
directImports.push(direct);

View File

@@ -0,0 +1,16 @@
/// <reference path="fourslash.ts" />
// @Filename: /leafModule.ts
////[|export const [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}hello|] = () => 'Hello';|]
// @Filename: /exporting.ts
////export * as Leaf from './leafModule';
// @Filename: /importing.ts
//// import { Leaf } from './exporting';
//// Leaf.[|hello|]()
verify.noErrors();
const ranges = test.ranges();
const [r0Def, r0, r1] = ranges;
verify.singleReferenceGroup("const hello: () => string", [r0, r1]);