We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 764af0e commit 979295bCopy full SHA for 979295b
1 file changed
src/compiler/emitter.ts
@@ -1862,8 +1862,19 @@ namespace ts {
1862
}
1863
1864
function emitModuleDeclaration(node: ModuleDeclaration) {
1865
- emitModifiers(node, node.modifiers);
1866
- write(node.flags & NodeFlags.Namespace ? "namespace " : "module ");
+ if (node.flags & NodeFlags.GlobalAugmentation) {
+ if (!hasModifier(node, ModifierFlags.Ambient)) {
1867
+ // Always emit a 'declare' keyword in case it wasn't provided by a factory function call.
1868
+ write("declare ");
1869
+ }
1870
+ else {
1871
+ emitModifiers(node, node.modifiers);
1872
1873
1874
1875
1876
+ write(node.flags & NodeFlags.Namespace ? "namespace " : "module ");
1877
1878
emit(node.name);
1879
1880
let body = node.body;
0 commit comments