fix(55823) - Remove Braces From Arrow function fails when using satisfies (#55831)

This commit is contained in:
Oleksandr T
2023-09-22 21:32:56 +03:00
committed by GitHub
parent c5cd2758fd
commit ec2acc9f8a
2 changed files with 15 additions and 1 deletions

View File

@@ -226,6 +226,7 @@ import {
isRequireVariableStatement,
isRightSideOfQualifiedNameOrPropertyAccess,
isRootedDiskPath,
isSatisfiesExpression,
isSetAccessorDeclaration,
isSourceFile,
isSourceFileJS,
@@ -3355,7 +3356,7 @@ function indexInTextChange(change: string, name: string): number {
export function needsParentheses(expression: Expression): boolean {
return isBinaryExpression(expression) && expression.operatorToken.kind === SyntaxKind.CommaToken
|| isObjectLiteralExpression(expression)
|| isAsExpression(expression) && isObjectLiteralExpression(expression.expression);
|| (isAsExpression(expression) || isSatisfiesExpression(expression)) && isObjectLiteralExpression(expression.expression);
}
/** @internal */