TypeScript/tests/cases/fourslash/findAllRefsReExportStarAs.ts
Sheetal Nandi b397d1fd4a
Fixes searches for export * as 'identifier' (#39533)
* Fixes searches for export * as 'identifier'
Fixes #39006

* Fix the context span to export declaration (was incorrectly set to sourceFile in prev commit)
2020-07-09 13:45:43 -07:00

21 lines
1.2 KiB
TypeScript

/// <reference path="fourslash.ts" />
// @Filename: /leafModule.ts
////[|{| "id": "helloDecl" |}export const [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "helloDecl" |}hello|] = () => 'Hello';|]
// @Filename: /exporting.ts
////[|{| "id": "leafExportDecl" |}export * as [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "leafExportDecl" |}Leaf|] from './leafModule';|]
// @Filename: /importing.ts
//// [|{| "id": "leafImportDecl" |}import { [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "leafImportDecl" |}Leaf|] } from './exporting';|]
//// [|Leaf|].[|hello|]()
verify.noErrors();
const ranges = test.ranges();
const [helloDecl, helloDef, leafExportDecl, leafDef, leafImportDecl, leafImportDef, leafUse, helloUse] = ranges;
verify.singleReferenceGroup("const hello: () => string", [helloDef, helloUse]);
const leafExportAsRef = { definition: "import Leaf", ranges: [leafDef] };
const leafImportRef = { definition: "import Leaf", ranges: [leafImportDef, leafUse] };
verify.referenceGroups([leafDef], [leafExportAsRef, leafImportRef]);
verify.referenceGroups([leafImportDef, leafUse], [leafImportRef, leafExportAsRef]);