File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -1862,8 +1862,19 @@ namespace ts {
1862
1862
}
1863
1863
1864
1864
function emitModuleDeclaration ( node : ModuleDeclaration ) {
1865
- emitModifiers ( node , node . modifiers ) ;
1866
- write ( node . flags & NodeFlags . Namespace ? "namespace " : "module " ) ;
1865
+ if ( node . flags & NodeFlags . GlobalAugmentation ) {
1866
+ 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
+ else {
1875
+ emitModifiers ( node , node . modifiers ) ;
1876
+ write ( node . flags & NodeFlags . Namespace ? "namespace " : "module " ) ;
1877
+ }
1867
1878
emit ( node . name ) ;
1868
1879
1869
1880
let body = node . body ;
You can’t perform that action at this time.
0 commit comments