Skip to content

Commit 946a14f

Browse files
committed
Allow expando additions to an imported object in JavaScript - fixes microsoft#31312
1 parent dbe9e3d commit 946a14f

File tree

3 files changed

+5
-14
lines changed

3 files changed

+5
-14
lines changed

src/compiler/checker.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29974,7 +29974,7 @@ namespace ts {
2997429974
const symbol = getSymbolOfNode(node);
2997529975
const target = resolveAlias(symbol);
2997629976
if (target !== unknownSymbol) {
29977-
// For external modules symbol represent local symbol for an alias.
29977+
// For external modules symbol represents local symbol for an alias.
2997829978
// This local symbol will merge any other local declarations (excluding other aliases)
2997929979
// and symbol.flags will contains combined representation for all merged declaration.
2998029980
// Based on symbol.flags we can compute a set of excluded meanings (meaning that resolved alias should not have,
@@ -30004,7 +30004,9 @@ namespace ts {
3000430004
function checkImportBinding(node: ImportEqualsDeclaration | ImportClause | NamespaceImport | ImportSpecifier) {
3000530005
checkCollisionWithRequireExportsInGeneratedCode(node, node.name!);
3000630006
checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name!);
30007-
checkAliasSymbol(node);
30007+
if (!isInJSFile(node)) {
30008+
checkAliasSymbol(node);
30009+
}
3000830010
}
3000930011

3001030012
function checkImportDeclaration(node: ImportDeclaration) {

src/compiler/debug.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,4 +258,4 @@ namespace ts {
258258
isDebugInfoEnabled = true;
259259
}
260260
}
261-
}
261+
}

tests/baselines/reference/propertyAssignmentOnImportedSymbol.errors.txt

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)