From d6ae55708d993852a8dd81d6978c81b4bb4203ed Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Mon, 12 Oct 2015 14:25:39 -0700 Subject: [PATCH] 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. --- src/compiler/checker.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 228b1067bb0..cf8a2d676b4 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -10992,7 +10992,13 @@ namespace ts { function getEffectiveDeclarationFlags(n: Node, flagsToCheck: NodeFlags): NodeFlags { let flags = getCombinedNodeFlags(n); - if (n.parent.kind !== SyntaxKind.InterfaceDeclaration && isInAmbientContext(n)) { + + // children of classes (even ambient classes) should not be marked as ambient or export + // because those flags have no useful semantics there. + if (n.parent.kind !== SyntaxKind.InterfaceDeclaration && + n.parent.kind !== SyntaxKind.ClassDeclaration && + n.parent.kind !== SyntaxKind.ClassExpression && + isInAmbientContext(n)) { if (!(flags & NodeFlags.Ambient)) { // It is nested in an ambient context, which means it is automatically exported flags |= NodeFlags.Export;