@@ -31,13 +31,13 @@ export class Printer {
3131 : ! ! ( type . flags & ts . TypeFlags . Undefined ) ;
3232 }
3333
34- private printConditionTypeNode ( type : ts . ConditionalType ) {
34+ private printConditionType ( type : ts . ConditionalType , inner : boolean ) : string {
3535 const decl = type . root . node ;
3636 const { trueType, falseType } = decl ;
3737 const trueTypeNode = this . checker . getTypeAtLocation ( trueType ) ;
3838 const falseTypeNode = this . checker . getTypeAtLocation ( falseType ) ;
3939
40- return `${ this . printType ( trueTypeNode ) } | ${ this . printType ( falseTypeNode ) } ` ;
40+ return `${ this . printType ( trueTypeNode , inner ) } | ${ this . printType ( falseTypeNode , inner ) } ` ;
4141 }
4242
4343 private printPrimitiveType ( type : ts . Type ) : string {
@@ -115,7 +115,7 @@ export class Printer {
115115 } else if ( type . flags & ts . TypeFlags . Undefined ) {
116116 return "" ;
117117 } else if ( type . flags & ts . TypeFlags . Conditional ) {
118- return this . printConditionTypeNode ( type as ts . ConditionalType ) ;
118+ return this . printConditionType ( type as ts . ConditionalType , inner ) ;
119119 } else if ( type . isTypeParameter ( ) ) {
120120 const symbol = type . getSymbol ( ) ;
121121 const decl = symbol ?. declarations ?. [ 0 ] ;
@@ -128,7 +128,7 @@ export class Printer {
128128 }
129129 const refType = this . checker . getTypeAtLocation ( ref ) ;
130130
131- return this . printType ( refType ) ;
131+ return this . printType ( refType , inner ) ;
132132 }
133133
134134 return this . typeToString ( type ) ;
0 commit comments