fix(55823) - Remove Braces From Arrow function fails when using satisfies (#55831)
This commit is contained in:
Родитель
c5cd2758fd
Коммит
ec2acc9f8a
|
@ -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 */
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
/// <reference path='fourslash.ts' />
|
||||
|
||||
/////*a*/()/*b*/ => {
|
||||
//// return {} satisfies any
|
||||
////}
|
||||
|
||||
goTo.select("a", "b");
|
||||
edit.applyRefactor({
|
||||
refactorName: "Add or remove braces in an arrow function",
|
||||
actionName: "Remove braces from arrow function",
|
||||
actionDescription: "Remove braces from arrow function",
|
||||
newContent: "() => ({} satisfies any)",
|
||||
});
|
Загрузка…
Ссылка в новой задаче