mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Add missing emitter for NamespaceExportDeclaration (#16025)
This commit is contained in:
@@ -3398,6 +3398,7 @@ namespace ts {
|
||||
case SyntaxKind.IndexedAccessType:
|
||||
case SyntaxKind.MappedType:
|
||||
case SyntaxKind.LiteralType:
|
||||
case SyntaxKind.NamespaceExportDeclaration:
|
||||
// Types and signatures are TypeScript syntax, and exclude all other facts.
|
||||
transformFlags = TransformFlags.AssertTypeScript;
|
||||
excludeFlags = TransformFlags.TypeExcludes;
|
||||
|
||||
@@ -571,6 +571,8 @@ namespace ts {
|
||||
return emitModuleBlock(<ModuleBlock>node);
|
||||
case SyntaxKind.CaseBlock:
|
||||
return emitCaseBlock(<CaseBlock>node);
|
||||
case SyntaxKind.NamespaceExportDeclaration:
|
||||
return emitNamespaceExportDeclaration(<NamespaceExportDeclaration>node);
|
||||
case SyntaxKind.ImportEqualsDeclaration:
|
||||
return emitImportEqualsDeclaration(<ImportEqualsDeclaration>node);
|
||||
case SyntaxKind.ImportDeclaration:
|
||||
@@ -1886,6 +1888,12 @@ namespace ts {
|
||||
write(";");
|
||||
}
|
||||
|
||||
function emitNamespaceExportDeclaration(node: NamespaceExportDeclaration) {
|
||||
write("export as namespace ");
|
||||
emit(node.name);
|
||||
write(";");
|
||||
}
|
||||
|
||||
function emitNamedExports(node: NamedExports) {
|
||||
emitNamedImportsOrExports(node);
|
||||
}
|
||||
|
||||
@@ -345,6 +345,9 @@ namespace ts {
|
||||
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
// TypeScript property declarations are elided.
|
||||
|
||||
case SyntaxKind.NamespaceExportDeclaration:
|
||||
// TypeScript namespace export declarations are elided.
|
||||
return undefined;
|
||||
|
||||
case SyntaxKind.Constructor:
|
||||
|
||||
@@ -131,6 +131,9 @@ namespace ts {
|
||||
|
||||
// tslint:enable boolean-trivia
|
||||
printsCorrectly("class", {}, printer => printer.printNode(EmitHint.Unspecified, syntheticNode, sourceFile));
|
||||
|
||||
printsCorrectly("namespaceExportDeclaration", {}, printer => printer.printNode(EmitHint.Unspecified, createNamespaceExportDeclaration("B"), sourceFile));
|
||||
|
||||
printsCorrectly("classWithOptionalMethodAndProperty", {}, printer => printer.printNode(EmitHint.Unspecified, classWithOptionalMethodAndProperty, sourceFile));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
export as namespace B;
|
||||
Reference in New Issue
Block a user