diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts
index d8c94e8c7729a..0371fff09c442 100644
--- a/src/services/formatting/rules.ts
+++ b/src/services/formatting/rules.ts
@@ -409,6 +409,7 @@ namespace ts.formatting {
switch (context.contextNode.kind) {
case SyntaxKind.BinaryExpression:
case SyntaxKind.ConditionalExpression:
+ case SyntaxKind.ConditionalType:
case SyntaxKind.AsExpression:
case SyntaxKind.ExportSpecifier:
case SyntaxKind.ImportSpecifier:
@@ -461,7 +462,8 @@ namespace ts.formatting {
}
function isConditionalOperatorContext(context: FormattingContext): boolean {
- return context.contextNode.kind === SyntaxKind.ConditionalExpression;
+ return context.contextNode.kind === SyntaxKind.ConditionalExpression ||
+ context.contextNode.kind === SyntaxKind.ConditionalType;
}
function isSameLineTokenOrBeforeBlockContext(context: FormattingContext): boolean {
diff --git a/tests/cases/fourslash/formattingConditionalOperator.ts b/tests/cases/fourslash/formattingConditionalOperator.ts
index 545adb572b152..308f39315a3c7 100644
--- a/tests/cases/fourslash/formattingConditionalOperator.ts
+++ b/tests/cases/fourslash/formattingConditionalOperator.ts
@@ -3,4 +3,4 @@
////var x=true?1:2
format.document();
goTo.bof();
-verify.currentLineContentIs("var x = true ? 1 : 2");;
\ No newline at end of file
+verify.currentLineContentIs("var x = true ? 1 : 2");
\ No newline at end of file
diff --git a/tests/cases/fourslash/formattingConditionalTypes.ts b/tests/cases/fourslash/formattingConditionalTypes.ts
new file mode 100644
index 0000000000000..1d9526ef7bc11
--- /dev/null
+++ b/tests/cases/fourslash/formattingConditionalTypes.ts
@@ -0,0 +1,12 @@
+///
+
+/////*L1*/type Diff1 = T extends U?never:T;
+/////*L2*/type Diff2 = T extends U ? never : T;
+
+format.document();
+
+goTo.marker("L1");
+verify.currentLineContentIs("type Diff1 = T extends U ? never : T;");
+
+goTo.marker("L2");
+verify.currentLineContentIs("type Diff2 = T extends U ? never : T;");
\ No newline at end of file