Skip to content

Commit a0d4e4f

Browse files
committed
Fix getter of local symbol for export= when it is json module
Fixes microsoft#24341
1 parent 56f33ad commit a0d4e4f

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/services/importTracker.ts

+3
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,9 @@ namespace ts.FindAllReferences {
579579
else if (isBinaryExpression(decl)) { // `module.exports = class {}`
580580
return Debug.assertDefined(decl.right.symbol);
581581
}
582+
else if (isSourceFile(decl)) { // json module
583+
return Debug.assertDefined(decl.symbol);
584+
}
582585
return Debug.fail();
583586
}
584587

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
// @resolveJsonModule: true
4+
// @module: commonjs
5+
// @esModuleInterop: true
6+
7+
// @Filename: /foo.ts
8+
////import [|{| "isWriteAccess": true, "isDefinition": true |}settings|] from "./settings.json";
9+
////[|settings|];
10+
11+
// @Filename: /settings.json
12+
//// {}
13+
14+
verify.singleReferenceGroup("import settings");

0 commit comments

Comments
 (0)