mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
fix(52050): The space before satisfies after an array expression is removed when auto-formatting the statements (#52053)
This commit is contained in:
parent
aae3115838
commit
c57fea2a0d
@ -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,
|
||||
|
||||
14
tests/cases/fourslash/formatSatisfiesExpression.ts
Normal file
14
tests/cases/fourslash/formatSatisfiesExpression.ts
Normal 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[];`
|
||||
);
|
||||
Loading…
x
Reference in New Issue
Block a user