fix no space before equal operator in type parameter

This commit is contained in:
xiaofa
2019-02-20 18:12:09 +08:00
parent b2b360a64f
commit 7c8c6cf4d0
2 changed files with 9 additions and 1 deletions

View File

@@ -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;

View File

@@ -0,0 +1,8 @@
/// <reference path="fourslash.ts"/>
/////**/type Bar<T extends any[]= any[]> = T
format.document();
goTo.marker();
verify.currentLineContentIs('type Bar<T extends any[] = any[]> = T');