Skip to content

[release-2.9] Fix getter of local symbol for export= when it is json module #24349

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/services/importTracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,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");