Skip to content

Commit c57fea2

Browse files
authored
fix(52050): The space before satisfies after an array expression is removed when auto-formatting the statements (#52053)
1 parent aae3115 commit c57fea2

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/services/formatting/rules.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,11 @@ export function getAllRules(): RuleSpec[] {
5757
const anyTokenIncludingEOF = tokenRangeFrom([...allTokens, SyntaxKind.EndOfFileToken]);
5858
const keywords = tokenRangeFromRange(SyntaxKind.FirstKeyword, SyntaxKind.LastKeyword);
5959
const binaryOperators = tokenRangeFromRange(SyntaxKind.FirstBinaryOperator, SyntaxKind.LastBinaryOperator);
60-
const binaryKeywordOperators = [SyntaxKind.InKeyword, SyntaxKind.InstanceOfKeyword, SyntaxKind.OfKeyword, SyntaxKind.AsKeyword, SyntaxKind.IsKeyword];
60+
const binaryKeywordOperators = [
61+
SyntaxKind.InKeyword, SyntaxKind.InstanceOfKeyword,
62+
SyntaxKind.OfKeyword, SyntaxKind.AsKeyword,
63+
SyntaxKind.IsKeyword, SyntaxKind.SatisfiesKeyword,
64+
];
6165
const unaryPrefixOperators = [SyntaxKind.PlusPlusToken, SyntaxKind.MinusMinusToken, SyntaxKind.TildeToken, SyntaxKind.ExclamationToken];
6266
const unaryPrefixExpressions = [
6367
SyntaxKind.NumericLiteral, SyntaxKind.BigIntLiteral, SyntaxKind.Identifier, SyntaxKind.OpenParenToken,
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
////type Foo = "a" | "b" | "c";
4+
////const foo1 = ["a"] satisfies Foo[];
5+
////const foo2 = ["a"]satisfies Foo[];
6+
////const foo3 = ["a"] satisfies Foo[];
7+
8+
format.document();
9+
verify.currentFileContentIs(
10+
`type Foo = "a" | "b" | "c";
11+
const foo1 = ["a"] satisfies Foo[];
12+
const foo2 = ["a"] satisfies Foo[];
13+
const foo3 = ["a"] satisfies Foo[];`
14+
);

0 commit comments

Comments
 (0)