Skip to content

Commit 8dd5706

Browse files
committed
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
1 parent 946a14f commit 8dd5706

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/compiler/checker.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -29973,7 +29973,10 @@ namespace ts {
2997329973
function checkAliasSymbol(node: ImportEqualsDeclaration | ImportClause | NamespaceImport | ImportSpecifier | ExportSpecifier) {
2997429974
const symbol = getSymbolOfNode(node);
2997529975
const target = resolveAlias(symbol);
29976-
if (target !== unknownSymbol) {
29976+
29977+
const shouldSkipWithJSRequireTargets = !isInJSFile(node) && moduleKind !== ModuleKind.ES2015;
29978+
29979+
if (shouldSkipWithJSRequireTargets && target !== unknownSymbol) {
2997729980
// For external modules symbol represents local symbol for an alias.
2997829981
// This local symbol will merge any other local declarations (excluding other aliases)
2997929982
// and symbol.flags will contains combined representation for all merged declaration.
@@ -30004,9 +30007,7 @@ namespace ts {
3000430007
function checkImportBinding(node: ImportEqualsDeclaration | ImportClause | NamespaceImport | ImportSpecifier) {
3000530008
checkCollisionWithRequireExportsInGeneratedCode(node, node.name!);
3000630009
checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name!);
30007-
if (!isInJSFile(node)) {
30008-
checkAliasSymbol(node);
30009-
}
30010+
checkAliasSymbol(node);
3001030011
}
3001130012

3001230013
function checkImportDeclaration(node: ImportDeclaration) {

0 commit comments

Comments
 (0)