fix no space before equal operator in type parameter (#29990)

fix no space before equal operator in type parameter
This commit is contained in:
Daniel Rosenwasser 2019-02-20 12:16:18 -08:00 committed by GitHub
commit 4e3efc2e90
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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');