Skip to content

Commit d6ae557

Browse files
committed
Do not mark class members as ambient or export.
Even members of ambient classes. These flags have no useful semantics there, and it prevents ambient classes from merging properly with interfaces.
1 parent 12b436b commit d6ae557

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/compiler/checker.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10992,7 +10992,13 @@ namespace ts {
1099210992

1099310993
function getEffectiveDeclarationFlags(n: Node, flagsToCheck: NodeFlags): NodeFlags {
1099410994
let flags = getCombinedNodeFlags(n);
10995-
if (n.parent.kind !== SyntaxKind.InterfaceDeclaration && isInAmbientContext(n)) {
10995+
10996+
// children of classes (even ambient classes) should not be marked as ambient or export
10997+
// because those flags have no useful semantics there.
10998+
if (n.parent.kind !== SyntaxKind.InterfaceDeclaration &&
10999+
n.parent.kind !== SyntaxKind.ClassDeclaration &&
11000+
n.parent.kind !== SyntaxKind.ClassExpression &&
11001+
isInAmbientContext(n)) {
1099611002
if (!(flags & NodeFlags.Ambient)) {
1099711003
// It is nested in an ambient context, which means it is automatically exported
1099811004
flags |= NodeFlags.Export;

0 commit comments

Comments
 (0)