Skip to content

Commit 3d224bd

Browse files
committed
Emit declarations of namespaces correctelly
1 parent 247d582 commit 3d224bd

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

Jakefile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ compileFile(servicesFile, servicesSources,[builtLocalDirectory, copyright].conca
361361
// Create the node definition file by replacing 'ts' module with '"typescript"' as a module.
362362
jake.cpR(standaloneDefinitionsFile, nodeDefinitionsFile, {silent: true});
363363
var definitionFileContents = fs.readFileSync(nodeDefinitionsFile).toString();
364-
definitionFileContents = definitionFileContents.replace(/declare module ts/g, 'declare module "typescript"');
364+
definitionFileContents = definitionFileContents.replace(/declare namespace ts/g, 'declare module "typescript"');
365365
fs.writeFileSync(nodeDefinitionsFile, definitionFileContents);
366366
});
367367

src/compiler/declarationEmitter.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,12 @@ namespace ts {
709709
function writeModuleDeclaration(node: ModuleDeclaration) {
710710
emitJsDocComments(node);
711711
emitModuleElementDeclarationFlags(node);
712-
write("module ");
712+
if (node.flags & NodeFlags.Namespace) {
713+
write("namespace ");
714+
}
715+
else {
716+
write("module ");
717+
}
713718
writeTextOfNode(currentSourceFile, node.name);
714719
while (node.body.kind !== SyntaxKind.ModuleBlock) {
715720
node = <ModuleDeclaration>node.body;

0 commit comments

Comments
 (0)