File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -758,7 +758,15 @@ function canRemoveParentheses(node: ParenthesizedExpression): boolean {
758
758
759
759
const innerExpression = node . getExpression ( ) ;
760
760
761
- // Remove parentheses safely only if the parent allows it
761
+ // If the immediate inner expression is a binary expression with `||`, skip removal
762
+ if (
763
+ innerExpression . isKind ( SyntaxKind . BinaryExpression ) &&
764
+ ( innerExpression as BinaryExpression ) . getOperatorToken ( ) . getText ( ) === "||"
765
+ ) {
766
+ return false ;
767
+ }
768
+
769
+ // Allow removal in safe contexts
762
770
if (
763
771
parent . isKind ( SyntaxKind . BinaryExpression ) ||
764
772
parent . isKind ( SyntaxKind . IfStatement ) ||
@@ -773,6 +781,7 @@ function canRemoveParentheses(node: ParenthesizedExpression): boolean {
773
781
774
782
775
783
784
+
776
785
/**
777
786
* Apply the transformations. Progressize inlining and unrolling, then else inversion and if flattening.
778
787
*/
You can’t perform that action at this time.
0 commit comments