File tree Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -409,6 +409,7 @@ namespace ts.formatting {
409409 switch ( context . contextNode . kind ) {
410410 case SyntaxKind . BinaryExpression :
411411 case SyntaxKind . ConditionalExpression :
412+ case SyntaxKind . ConditionalType :
412413 case SyntaxKind . AsExpression :
413414 case SyntaxKind . ExportSpecifier :
414415 case SyntaxKind . ImportSpecifier :
@@ -461,7 +462,8 @@ namespace ts.formatting {
461462 }
462463
463464 function isConditionalOperatorContext ( context : FormattingContext ) : boolean {
464- return context . contextNode . kind === SyntaxKind . ConditionalExpression ;
465+ return context . contextNode . kind === SyntaxKind . ConditionalExpression ||
466+ context . contextNode . kind === SyntaxKind . ConditionalType ;
465467 }
466468
467469 function isSameLineTokenOrBeforeBlockContext ( context : FormattingContext ) : boolean {
Original file line number Diff line number Diff line change 33////var x=true?1:2
44format . document ( ) ;
55goTo . bof ( ) ;
6- verify . currentLineContentIs ( "var x = true ? 1 : 2" ) ; ;
6+ verify . currentLineContentIs ( "var x = true ? 1 : 2" ) ;
Original file line number Diff line number Diff line change 1+ /// <reference path='fourslash.ts'/>
2+
3+ /////*L1*/type Diff1<T, U> = T extends U?never:T;
4+ /////*L2*/type Diff2<T, U> = T extends U ? never : T;
5+
6+ format . document ( ) ;
7+
8+ goTo . marker ( "L1" ) ;
9+ verify . currentLineContentIs ( "type Diff1<T, U> = T extends U ? never : T;" ) ;
10+
11+ goTo . marker ( "L2" ) ;
12+ verify . currentLineContentIs ( "type Diff2<T, U> = T extends U ? never : T;" ) ;
You can’t perform that action at this time.
0 commit comments