@@ -75,7 +75,7 @@ namespace ts {
7575 } ) . outputText ;
7676 } ) ;
7777
78- testBaseline ( "synthesizedNamespace " , ( ) => {
78+ testBaseline ( "rewrittenNamespace " , ( ) => {
7979 return ts . transpileModule ( `namespace Reflect { const x = 1; }` , {
8080 transformers : {
8181 before : [ forceNamespaceRewrite ] ,
@@ -86,7 +86,7 @@ namespace ts {
8686 } ) . outputText ;
8787 } ) ;
8888
89- testBaseline ( "synthesizedNamespaceFollowingClass " , ( ) => {
89+ testBaseline ( "rewrittenNamespaceFollowingClass " , ( ) => {
9090 return ts . transpileModule ( `
9191 class C { foo = 10; static bar = 20 }
9292 namespace C { export let x = 10; }
@@ -101,6 +101,29 @@ namespace ts {
101101 } ) . outputText ;
102102 } ) ;
103103
104+ testBaseline ( "synthesizedClassAndNamespaceCombination" , ( ) => {
105+ return ts . transpileModule ( "" , {
106+ transformers : {
107+ before : [ replaceWithClassAndNamespace ] ,
108+ } ,
109+ compilerOptions : {
110+ target : ts . ScriptTarget . ESNext ,
111+ newLine : NewLineKind . CarriageReturnLineFeed ,
112+ }
113+ } ) . outputText ;
114+
115+ function replaceWithClassAndNamespace ( ) {
116+ return ( sourceFile : ts . SourceFile ) => {
117+ const result = getMutableClone ( sourceFile ) ;
118+ result . statements = ts . createNodeArray ( [
119+ ts . createClassDeclaration ( undefined , undefined , "Foo" , undefined , undefined , undefined ) ,
120+ ts . createModuleDeclaration ( undefined , undefined , createIdentifier ( "Foo" ) , createModuleBlock ( [ createEmptyStatement ( ) ] ) )
121+ ] ) ;
122+ return result ;
123+ }
124+ }
125+ } ) ;
126+
104127 function forceNamespaceRewrite ( context : ts . TransformationContext ) {
105128 return ( sourceFile : ts . SourceFile ) : ts . SourceFile => {
106129 return visitNode ( sourceFile ) ;
0 commit comments