diff --git a/src/common/fast-path.js b/src/common/fast-path.js index f7f32514..44a65133 100644 --- a/src/common/fast-path.js +++ b/src/common/fast-path.js @@ -320,6 +320,7 @@ FastPath.prototype.needsParens = function(options) { case "AwaitExpression": case "TSAsExpression": case "TSNonNullExpression": + case "UpdateExpression": return true; case "MemberExpression": diff --git a/tests/typescript_as/__snapshots__/jsfmt.spec.js.snap b/tests/typescript_as/__snapshots__/jsfmt.spec.js.snap index 73a1f83f..014f93fe 100644 --- a/tests/typescript_as/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript_as/__snapshots__/jsfmt.spec.js.snap @@ -24,6 +24,7 @@ const state = JSON.stringify({ } as State); (foo.bar as Baz) = [bar]; +(foo.bar as any)++; (bValue as boolean) ? 0 : -1; bValue ? 0 : -1; @@ -59,6 +60,7 @@ const state = JSON.stringify({ } as State); (foo.bar as Baz) = [bar]; +(foo.bar as any)++; (bValue as boolean) ? 0 : -1; bValue ? 0 : -1; diff --git a/tests/typescript_as/as.js b/tests/typescript_as/as.js index 1bedea90..464285c0 100644 --- a/tests/typescript_as/as.js +++ b/tests/typescript_as/as.js @@ -21,6 +21,7 @@ const state = JSON.stringify({ } as State); (foo.bar as Baz) = [bar]; +(foo.bar as any)++; (bValue as boolean) ? 0 : -1; bValue ? 0 : -1;