fix no space before equal operator in type parameter (#29990)
fix no space before equal operator in type parameter
This commit is contained in:
commit
4e3efc2e90
|
@ -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;
|
||||
|
|
8
tests/cases/fourslash/formatTypeParameters.ts
Normal file
8
tests/cases/fourslash/formatTypeParameters.ts
Normal 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');
|
Loading…
Reference in a new issue