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.
This commit is contained in:
Nathan Shively-Sanders
2015-10-12 14:25:39 -07:00
parent 12b436bb2c
commit d6ae55708d

View File

@@ -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;