Skip to content

Commit 64edd07

Browse files
authored
fix(57590): [Formatting] Remove spaces between ... and type name in tuple spread (microsoft#57604)
1 parent 1d6d962 commit 64edd07

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/services/formatting/rules.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,9 @@ export function getAllRules(): RuleSpec[] {
398398
// Remove extra space between for and await
399399
rule("SpaceBetweenForAndAwaitKeyword", SyntaxKind.ForKeyword, SyntaxKind.AwaitKeyword, [isNonJsxSameLineTokenContext], RuleAction.InsertSpace),
400400

401+
// Remove extra spaces between ... and type name in tuple spread
402+
rule("SpaceBetweenDotDotDotAndTypeName", SyntaxKind.DotDotDotToken, typeNames, [isNonJsxSameLineTokenContext], RuleAction.DeleteSpace),
403+
401404
// Add a space between statements. All keywords except (do,else,case) has open/close parens after them.
402405
// So, we have a rule to add a space for [),Any], [do,Any], [else,Any], and [case,Any]
403406
rule(
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/// <reference path="fourslash.ts"/>
2+
3+
//// let a: [... any[]];
4+
//// let b: [... number[]];
5+
//// let c: [... string[]];
6+
7+
format.document();
8+
verify.currentFileContentIs(
9+
`let a: [...any[]];
10+
let b: [...number[]];
11+
let c: [...string[]];`
12+
);

0 commit comments

Comments
 (0)