From 8dd57061e1361bee525267c53ddc9bbca4cf79c3 Mon Sep 17 00:00:00 2001 From: Orta Therox Date: Tue, 30 Jul 2019 15:51:53 -0400 Subject: [PATCH] Ensure that when import/export are used natively in the JS runtime that the check for alias symbol is re-applied - re comment in #26912 --- src/compiler/checker.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 007be810e48..02b6e9913e7 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -29973,7 +29973,10 @@ namespace ts { function checkAliasSymbol(node: ImportEqualsDeclaration | ImportClause | NamespaceImport | ImportSpecifier | ExportSpecifier) { const symbol = getSymbolOfNode(node); const target = resolveAlias(symbol); - if (target !== unknownSymbol) { + + const shouldSkipWithJSRequireTargets = !isInJSFile(node) && moduleKind !== ModuleKind.ES2015; + + if (shouldSkipWithJSRequireTargets && 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. @@ -30004,9 +30007,7 @@ namespace ts { function checkImportBinding(node: ImportEqualsDeclaration | ImportClause | NamespaceImport | ImportSpecifier) { checkCollisionWithRequireExportsInGeneratedCode(node, node.name!); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name!); - if (!isInJSFile(node)) { - checkAliasSymbol(node); - } + checkAliasSymbol(node); } function checkImportDeclaration(node: ImportDeclaration) {