Don't exclusively check for just JS but scope down the check to not include the expando'd objects

This commit is contained in:
Orta Therox 2019-07-31 14:34:21 -04:00
parent 8dd57061e1
commit 44b13ee475

View file

@ -29974,9 +29974,8 @@ namespace ts {
const symbol = getSymbolOfNode(node);
const target = resolveAlias(symbol);
const shouldSkipWithJSRequireTargets = !isInJSFile(node) && moduleKind !== ModuleKind.ES2015;
if (shouldSkipWithJSRequireTargets && target !== unknownSymbol) {
const shouldSkipWithJSExpandoTargets = symbol.flags & SymbolFlags.Assignment;
if (!shouldSkipWithJSExpandoTargets && target !== unknownSymbol) {
// For external modules symbol represents local symbol for an alias.
// This local symbol will merge any other local declarations (excluding other aliases)
// and symbol.flags will contains combined representation for all merged declaration.