Keep parens around Unary and Update Expressions (#3989)

This commit is contained in:
Lucas Azzola authored and GitHub committed 2018-02-18 00:22:35 +11:00
1 parent a8fe401b26
commit 417c50aa84
3 files changed
+6

No files matched your search

+3
View File
@@ -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
View File
@@ -1,5 +1,6 @@
(a ? b : c) ![tokenKey];
(a || b) ![tokenKey];
(void 0)!;
async function f() {
return (await foo())!;