fix(52050): The space before satisfies after an array expression is removed when auto-formatting the statements (#52053)

This commit is contained in:
Oleksandr T 2023-01-05 23:30:11 +02:00 committed by GitHub
parent aae3115838
commit c57fea2a0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 1 deletions

View File

@ -57,7 +57,11 @@ export function getAllRules(): RuleSpec[] {
const anyTokenIncludingEOF = tokenRangeFrom([...allTokens, SyntaxKind.EndOfFileToken]);
const keywords = tokenRangeFromRange(SyntaxKind.FirstKeyword, SyntaxKind.LastKeyword);
const binaryOperators = tokenRangeFromRange(SyntaxKind.FirstBinaryOperator, SyntaxKind.LastBinaryOperator);
const binaryKeywordOperators = [SyntaxKind.InKeyword, SyntaxKind.InstanceOfKeyword, SyntaxKind.OfKeyword, SyntaxKind.AsKeyword, SyntaxKind.IsKeyword];
const binaryKeywordOperators = [
SyntaxKind.InKeyword, SyntaxKind.InstanceOfKeyword,
SyntaxKind.OfKeyword, SyntaxKind.AsKeyword,
SyntaxKind.IsKeyword, SyntaxKind.SatisfiesKeyword,
];
const unaryPrefixOperators = [SyntaxKind.PlusPlusToken, SyntaxKind.MinusMinusToken, SyntaxKind.TildeToken, SyntaxKind.ExclamationToken];
const unaryPrefixExpressions = [
SyntaxKind.NumericLiteral, SyntaxKind.BigIntLiteral, SyntaxKind.Identifier, SyntaxKind.OpenParenToken,

View File

@ -0,0 +1,14 @@
/// <reference path="fourslash.ts" />
////type Foo = "a" | "b" | "c";
////const foo1 = ["a"] satisfies Foo[];
////const foo2 = ["a"]satisfies Foo[];
////const foo3 = ["a"] satisfies Foo[];
format.document();
verify.currentFileContentIs(
`type Foo = "a" | "b" | "c";
const foo1 = ["a"] satisfies Foo[];
const foo2 = ["a"] satisfies Foo[];
const foo3 = ["a"] satisfies Foo[];`
);