Skip to content

Commit

Permalink
Ensure that when import/export are used natively in the JS runtime th…
Browse files Browse the repository at this point in the history
…at the check for alias symbol is re-applied - re comment in #26912
  • Loading branch information
orta committed Jul 30, 2019
1 parent 946a14f commit 8dd5706
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 8dd5706

Please sign in to comment.