Skip to content

Commit

Permalink
Merge pull request microsoft#24348 from Microsoft/findRefInJson
Browse files Browse the repository at this point in the history
Fix getter of local symbol for export= when it is json module
  • Loading branch information
sheetalkamat authored May 23, 2018
2 parents 44da834 + a0d4e4f commit 16d7f4c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/services/importTracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,9 @@ namespace ts.FindAllReferences {
else if (isBinaryExpression(decl)) { // `module.exports = class {}`
return Debug.assertDefined(decl.right.symbol);
}
else if (isSourceFile(decl)) { // json module
return Debug.assertDefined(decl.symbol);
}
return Debug.fail();
}

Expand Down
14 changes: 14 additions & 0 deletions tests/cases/fourslash/findAllReferencesOfJsonModule.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/// <reference path='fourslash.ts' />

// @resolveJsonModule: true
// @module: commonjs
// @esModuleInterop: true

// @Filename: /foo.ts
////import [|{| "isWriteAccess": true, "isDefinition": true |}settings|] from "./settings.json";
////[|settings|];

// @Filename: /settings.json
//// {}

verify.singleReferenceGroup("import settings");

0 comments on commit 16d7f4c

Please sign in to comment.