Skip to content

Commit 4e3efc2

Browse files
fix no space before equal operator in type parameter (microsoft#29990)
fix no space before equal operator in type parameter
2 parents ee17915 + 7c8c6cf commit 4e3efc2

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/services/formatting/rules.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ namespace ts.formatting {
442442
case SyntaxKind.ForInStatement:
443443
// "in" keyword in [P in keyof T]: T[P]
444444
case SyntaxKind.TypeParameter:
445-
return context.currentTokenSpan.kind === SyntaxKind.InKeyword || context.nextTokenSpan.kind === SyntaxKind.InKeyword;
445+
return context.currentTokenSpan.kind === SyntaxKind.InKeyword || context.nextTokenSpan.kind === SyntaxKind.InKeyword || context.currentTokenSpan.kind === SyntaxKind.EqualsToken || context.nextTokenSpan.kind === SyntaxKind.EqualsToken;
446446
// Technically, "of" is not a binary operator, but format it the same way as "in"
447447
case SyntaxKind.ForOfStatement:
448448
return context.currentTokenSpan.kind === SyntaxKind.OfKeyword || context.nextTokenSpan.kind === SyntaxKind.OfKeyword;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/// <reference path="fourslash.ts"/>
2+
3+
/////**/type Bar<T extends any[]= any[]> = T
4+
5+
6+
format.document();
7+
goTo.marker();
8+
verify.currentLineContentIs('type Bar<T extends any[] = any[]> = T');

0 commit comments

Comments
 (0)