Make direct assignments to cjs exports considered literal contexts (#39816)

* Make direct assignments to cjs exports considered literal contexts

* Style feedback from PR

* Trailing whitespaaaaace
This commit is contained in:
Wesley Wigham
2022-03-09 13:27:39 -08:00
committed by GitHub
parent f76452cb27
commit 3f63804878
35 changed files with 300 additions and 199 deletions
@@ -0,0 +1,15 @@
// @declaration: true
// @emitDeclarationOnly: true
// @allowJs: true
// @checkJs: true
// @module: commonjs
// @target: es6
// @filename: file.js
const customSymbol = Symbol("custom");
// This is a common pattern in Node’s built-in modules:
module.exports = {
customSymbol,
};
exports.customSymbol2 = Symbol("custom");
@@ -16,13 +16,13 @@ goTo.file('/b.js')
const markers = test.markers();
verify.getInlayHints([
{
text: ': number',
text: ': 1',
position: markers[0].position,
kind: ts.InlayHintKind.Type,
whitespaceBefore: true
},
{
text: ': number',
text: ': 1',
position: markers[1].position,
kind: ts.InlayHintKind.Type,
whitespaceBefore: true