Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/services/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ import {
isRequireVariableStatement,
isRightSideOfQualifiedNameOrPropertyAccess,
isRootedDiskPath,
isSatisfiesExpression,
isSetAccessorDeclaration,
isSourceFile,
isSourceFileJS,
Expand Down Expand Up @@ -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 */
Expand Down
Original file line number Diff line number Diff line change
@@ -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)",
});