use 'declare global' to define augmentations for the global scope

This commit is contained in:
Vladimir Matveev
2015-12-28 12:03:54 -08:00
parent 3e1bc01a86
commit 7f2ebf928a
55 changed files with 554 additions and 79 deletions

View File

@@ -952,7 +952,7 @@ namespace ts {
}
break;
case SyntaxKind.ModuleDeclaration:
if ((<ModuleDeclaration>node).name.kind === SyntaxKind.StringLiteral && (inAmbientModule || node.flags & NodeFlags.Ambient || isDeclarationFile(file))) {
if (isAmbientModule(<ModuleDeclaration>node) && (inAmbientModule || node.flags & NodeFlags.Ambient || isDeclarationFile(file))) {
const moduleName = <LiteralExpression>(<ModuleDeclaration>node).name;
// Ambient module declarations can be interpreted as augmentations for some existing external modules.
// This will happen in two cases: