diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index b2dac950323..8d710f87a4e 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -442,7 +442,7 @@ namespace ts.formatting { case SyntaxKind.ForInStatement: // "in" keyword in [P in keyof T]: T[P] case SyntaxKind.TypeParameter: - return context.currentTokenSpan.kind === SyntaxKind.InKeyword || context.nextTokenSpan.kind === SyntaxKind.InKeyword; + return context.currentTokenSpan.kind === SyntaxKind.InKeyword || context.nextTokenSpan.kind === SyntaxKind.InKeyword || context.currentTokenSpan.kind === SyntaxKind.EqualsToken || context.nextTokenSpan.kind === SyntaxKind.EqualsToken; // Technically, "of" is not a binary operator, but format it the same way as "in" case SyntaxKind.ForOfStatement: return context.currentTokenSpan.kind === SyntaxKind.OfKeyword || context.nextTokenSpan.kind === SyntaxKind.OfKeyword; diff --git a/tests/cases/fourslash/formatTypeParameters.ts b/tests/cases/fourslash/formatTypeParameters.ts new file mode 100644 index 00000000000..a6823a4d0bf --- /dev/null +++ b/tests/cases/fourslash/formatTypeParameters.ts @@ -0,0 +1,8 @@ +/// + +/////**/type Bar = T + + +format.document(); +goTo.marker(); +verify.currentLineContentIs('type Bar = T'); \ No newline at end of file