@@ -31,13 +31,13 @@ export class Printer {
31
31
: ! ! ( type . flags & ts . TypeFlags . Undefined ) ;
32
32
}
33
33
34
- private printConditionTypeNode ( type : ts . ConditionalType ) {
34
+ private printConditionType ( type : ts . ConditionalType , inner : boolean ) : string {
35
35
const decl = type . root . node ;
36
36
const { trueType, falseType } = decl ;
37
37
const trueTypeNode = this . checker . getTypeAtLocation ( trueType ) ;
38
38
const falseTypeNode = this . checker . getTypeAtLocation ( falseType ) ;
39
39
40
- return `${ this . printType ( trueTypeNode ) } | ${ this . printType ( falseTypeNode ) } ` ;
40
+ return `${ this . printType ( trueTypeNode , inner ) } | ${ this . printType ( falseTypeNode , inner ) } ` ;
41
41
}
42
42
43
43
private printPrimitiveType ( type : ts . Type ) : string {
@@ -115,7 +115,7 @@ export class Printer {
115
115
} else if ( type . flags & ts . TypeFlags . Undefined ) {
116
116
return "" ;
117
117
} else if ( type . flags & ts . TypeFlags . Conditional ) {
118
- return this . printConditionTypeNode ( type as ts . ConditionalType ) ;
118
+ return this . printConditionType ( type as ts . ConditionalType , inner ) ;
119
119
} else if ( type . isTypeParameter ( ) ) {
120
120
const symbol = type . getSymbol ( ) ;
121
121
const decl = symbol ?. declarations ?. [ 0 ] ;
@@ -128,7 +128,7 @@ export class Printer {
128
128
}
129
129
const refType = this . checker . getTypeAtLocation ( ref ) ;
130
130
131
- return this . printType ( refType ) ;
131
+ return this . printType ( refType , inner ) ;
132
132
}
133
133
134
134
return this . typeToString ( type ) ;
0 commit comments