Fix getter of local symbol for export= when it is json module

Fixes #24341
This commit is contained in:
Sheetal Nandi 2018-05-22 17:10:56 -07:00
parent 56f33ad3bb
commit a0d4e4f059
2 changed files with 17 additions and 0 deletions

View file

@ -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();
}

View file

@ -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");