Keep parens around Unary and Update Expressions (#3989)
This commit is contained in:
1 parent
a8fe401b26
commit
417c50aa84
3 files changed
+6
No files matched your search
@@ -265,6 +265,9 @@ FastPath.prototype.needsParens = function(options) {
|
||||
case "BinaryExpression":
|
||||
return parent.operator === "**" && name === "left";
|
||||
|
||||
case "TSNonNullExpression":
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ const {
|
||||
exports[`parens.ts 1`] = `
|
||||
(a ? b : c) ![tokenKey];
|
||||
(a || b) ![tokenKey];
|
||||
(void 0)!;
|
||||
|
||||
async function f() {
|
||||
return (await foo())!;
|
||||
@@ -31,6 +32,7 @@ function* g() {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
(a ? b : c)![tokenKey];
|
||||
(a || b)![tokenKey];
|
||||
(void 0)!;
|
||||
|
||||
async function f() {
|
||||
return (await foo())!;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
(a ? b : c) ![tokenKey];
|
||||
(a || b) ![tokenKey];
|
||||
(void 0)!;
|
||||
|
||||
async function f() {
|
||||
return (await foo())!;
|
||||
|
||||
Reference in new issue
Block a user