Repository: prettier/prettier (JavaScript) — Bug Fix

Issue:
Invalid indentation: `return (foo ? bar1 : bar2).baz()`
**Prettier 1.14.2**
[Playground link](https://prettier.io/playground/#N4Igxg9gdgLgprEAuEACVkoGcaoCZyQBOAhvHqgLyoAUNJRA5gDSoCWjUERcASnAEcArnBwBRIkW4BKKgD5UwADpR0a1DxhCiqmivUHUMAJ4AHOBABmqBoyqVqAchxE2URo9QAfL-sNr6JlQAMmCbJgA6ADcSABsRAHlrUKMzC2tbaLjEyxpZBycXNw9pP38DAH5UABICWLhGMjhAlnZObj5BEXFJGTLytSRUAAsSKDx6gEEsYygwBPNSGDZoLBbWDi4efmFRGAkpIlLVA2kIywgIPIBuPwBfaWuQZhAIU2XV5FAGKQB3AAUGAgsMgQCQohA2HhniAAEakMAAazgMAAyqYSGBisgYEQRC83Fg4EQYP9SIwALYkZCWOJEl4AKywAA8AEII5FokgUuAAGTccBpdLgLwxRCJRFBsJIsOMsWgMNMrlgAHUoTBhsgABwABlFUiJKtIplBStExKigpePGEbB4ZJIlOpSFpsXpICJFLYOLxIo9xXqAEUhBB4EK3X6YDK1XgNcgACwvXEkNixYoAYQgFKpoK4UCtICERIAKjKQS7hXc7kA)
```sh
--parser babylon
--tab-width 4
```

**Input:**
```jsx
  const decorated = ((arg, ignoreRequestError) => {
      return (
          typeof arg === 'string' ||
          (arg && arg.valueOf && typeof arg.valueOf() === 'string')
              ? $delegate(arg, ignoreRequestError)
              : handleAsyncOperations(arg, ignoreRequestError)
      ).foo();
  });
```

**Output:**
```jsx
const decorated = (arg, ignoreRequestError) => {
    return (typeof arg === "string" ||
    (arg && arg.valueOf && typeof arg.valueOf() === "string")
        ? $delegate(arg, ignoreRequestError)
        : handleAsyncOperations(arg, ignoreRequestError)
    ).foo();
};

```

**Expected behavior:**

Correct indentation after `return`.


Discussion:

Resolving patch:
diff --git a/changelog_unreleased/javascript/10187.md b/changelog_unreleased/javascript/10187.md
new file mode 100644
index 000000000000..30714a50e5d9
--- /dev/null
+++ b/changelog_unreleased/javascript/10187.md
@@ -0,0 +1,67 @@
+#### Consistent indentations for conditional operators (#10187 by @sosukesuzuki)
+
+<!-- prettier-ignore -->
+```ts
+// Input
+const dotNotationMemberExpression = (
+  callNode.parent?.type === AST_NODE_TYPES.ChainExpression
+    ? callNode.parent.parent
+    : callNode.parent
+).TSESTree.BinaryExpression;
+const computedMemberExpression = (
+  callNode.parent?.type === AST_NODE_TYPES.ChainExpression
+    ? callNode.parent.parent
+    : callNode.parent
+)[TSESTree.BinaryExpression];
+const callExpressionCallee = (
+  callNode.parent?.type === AST_NODE_TYPES.ChainExpression
+    ? callNode.parent.parent
+    : callNode.parent
+)(TSESTree.BinaryExpression);
+const typeScriptAsExpression = (
+  callNode.parent?.type === AST_NODE_TYPES.ChainExpression
+    ? callNode.parent.parent
+    : callNode.parent
+) as TSESTree.BinaryExpression;
+
+// Prettier stable
+const dotNotationMemberExpression = (callNode.parent?.type ===
+AST_NODE_TYPES.ChainExpression
+  ? callNode.parent.parent
+  : callNode.parent
+).TSESTree.BinaryExpression;
+const computedMemberExpression = (callNode.parent?.type ===
+AST_NODE_TYPES.ChainExpression
+  ? callNode.parent.parent
+  : callNode.parent)[TSESTree.BinaryExpression];
+const callExpressionCallee = (callNode.parent?.type ===
+  AST_NODE_TYPES.ChainExpression
+  ? callNode.parent.parent
+  : callNode.parent)(TSESTree.BinaryExpression);
+const typeScriptAsExpression = (callNode.parent?.type ===
+AST_NODE_TYPES.ChainExpression
+  ? callNode.parent.parent
+  : callNode.parent) as TSESTree.BinaryExpression;
+
+// Prettier main
+const dotNotationMemberExpression = (
+  callNode.parent?.type === AST_NODE_TYPES.ChainExpression
+    ? callNode.parent.parent
+    : callNode.parent
+).TSESTree.BinaryExpression;
+const computedMemberExpression = (
+  callNode.parent?.type === AST_NODE_TYPES.ChainExpression
+    ? callNode.parent.parent
+    : callNode.parent
+)[TSESTree.BinaryExpression];
+const callExpressionCallee = (
+  callNode.parent?.type === AST_NODE_TYPES.ChainExpression
+    ? callNode.parent.parent
+    : callNode.parent
+)(TSESTree.BinaryExpression);
+const typeScriptAsExpression = (
+  callNode.parent?.type === AST_NODE_TYPES.ChainExpression
+    ? callNode.parent.parent
+    : callNode.parent
+) as TSESTree.BinaryExpression;
+```
diff --git a/src/language-js/print/ternary.js b/src/language-js/print/ternary.js
index 61d47d691f3e..ded3c4266197 100644
--- a/src/language-js/print/ternary.js
+++ b/src/language-js/print/ternary.js
@@ -6,6 +6,8 @@ const {
   isJsxNode,
   isBlockComment,
   getComments,
+  isChainElement,
+  isCallExpression,
   isMemberExpression,
 } = require("../utils");
 const { locStart, locEnd } = require("../loc");
@@ -158,6 +160,56 @@ function printTernaryTest(path, options, print) {
   return printed;
 }
 
+const ancestorNameMap = new Map([
+  ["AssignmentExpression", "right"],
+  ["VariableDeclarator", "init"],
+  ["ReturnStatement", "argument"],
+  ["ThrowStatement", "argument"],
+  ["UnaryExpression", "argument"],
+  ["YieldExpression", "argument"],
+]);
+function shouldExtraIndentForConditionalExpression(path) {
+  const node = path.getValue();
+  if (node.type !== "ConditionalExpression") {
+    return false;
+  }
+
+  let ancestorCount = 1;
+  let ancestor = path.getParentNode(ancestorCount);
+  if (!ancestor) {
+    return false;
+  }
+  while (isChainElement(ancestor)) {
+    ancestor = path.getParentNode(++ancestorCount);
+  }
+  const checkAncestor = (node) => {
+    const name = ancestorNameMap.get(ancestor.type);
+    return ancestor[name] === node;
+  };
+
+  const parent = path.getParentNode();
+  const name = path.getName();
+
+  if (
+    ((name === "callee" && parent.type === "NewExpression") ||
+      (name === "expression" && parent.type === "TSAsExpression")) &&
+    checkAncestor(parent)
+  ) {
+    return true;
+  }
+
+  if (
+    ((name === "callee" && isCallExpression(parent)) ||
+      (name === "object" && isMemberExpression(parent)) ||
+      (name === "expression" && parent.type === "TSNonNullExpression")) &&
+    checkAncestor(path.getParentNode(ancestorCount - 1))
+  ) {
+    return true;
+  }
+
+  return false;
+}
+
 /**
  * The following is the shared logic for
  * ternary operators, namely ConditionalExpression
@@ -313,13 +365,19 @@ function printTernary(path, options, print) {
       (parent.type === "NGPipeExpression" && parent.left === node)) &&
     !parent.computed;
 
+  const shouldExtraIndent = shouldExtraIndentForConditionalExpression(path);
+
   const result = maybeGroup([
     printTernaryTest(path, options, print),
     forceNoIndent ? parts : indent(parts),
-    isConditionalExpression && breakClosingParen ? softline : "",
+    isConditionalExpression && breakClosingParen && !shouldExtraIndent
+      ? softline
+      : "",
   ]);
 
-  return isParentTest ? group([indent([softline, result]), softline]) : result;
+  return isParentTest || shouldExtraIndent
+    ? group([indent([softline, result]), softline])
+    : result;
 }
 
 module.exports = { printTernary };
diff --git a/src/language-js/utils.js b/src/language-js/utils.js
index afbaa43b49b5..8f454752ad39 100644
--- a/src/language-js/utils.js
+++ b/src/language-js/utils.js
@@ -1327,6 +1327,16 @@ function getComments(node, flags, fn) {
 const isNextLineEmpty = (node, { originalText }) =>
   isNextLineEmptyAfterIndex(originalText, locEnd(node));
 
+function isChainElement(node) {
+  return (
+    node.type === "MemberExpression" ||
+    node.type === "OptionalMemberExpression" ||
+    node.type === "CallExpression" ||
+    node.type === "OptionalCallExpression" ||
+    node.type === "TSNonNullExpression"
+  );
+}
+
 module.exports = {
   getFunctionParameters,
   iterateFunctionParametersPath,
@@ -1347,6 +1357,7 @@ module.exports = {
   identity,
   isBinaryish,
   isBlockComment,
+  isChainElement,
   isLineComment,
   isPrettierIgnoreComment,
   isCallExpression,


Test patch:
diff --git a/tests/js/ternaries/__snapshots__/jsfmt.spec.js.snap b/tests/js/ternaries/__snapshots__/jsfmt.spec.js.snap
index b8fd647e7ea1..27a6f6055478 100644
--- a/tests/js/ternaries/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/js/ternaries/__snapshots__/jsfmt.spec.js.snap
@@ -1608,6 +1608,2146 @@ a
 ================================================================================
 `;
 
+exports[`indent-after-paren.js - {"tabWidth":4} format 1`] = `
+====================================options=====================================
+parsers: ["babel", "flow", "typescript"]
+printWidth: 80
+tabWidth: 4
+                                                                                | printWidth
+=====================================input======================================
+foo7 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+
+foo8 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo9 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+
+function foo10() {
+  return (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+}
+
+function foo11() {
+  throw (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+}
+
+function foo12() {
+  void (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+}
+
+foo13 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz
+).Fooooooooooo.Fooooooooooo;
+
+foo14 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo15 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz
+).Fooooooooooo.Fooooooooooo;
+
+function foo16() {
+  return (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz
+  ).Fooooooooooo.Fooooooooooo;
+}
+
+function foo17() {
+  throw (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz
+  ).Fooooooooooo.Fooooooooooo;
+}
+
+function foo18() {
+  void (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz
+  ).Fooooooooooo.Fooooooooooo;
+}
+
+foo19 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+
+foo20 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo21 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+
+function foo22() {
+  return (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+}
+
+function foo23() {
+  throw (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+}
+
+function foo24() {
+  void (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+}
+
+foo25 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+
+foo26 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo27 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+
+function foo28() {
+  return (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+}
+
+function foo29() {
+  throw (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+}
+
+function foo30() {
+  void (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+}
+
+function* foo31() {
+  yield (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+  yield (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+      ? baaaaaaaaaaaaaaaaaaaaar
+      : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+  yield (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+      ? baaaaaaaaaaaaaaaaaaaaar
+      : baaaaaaaaaaaaaaaaaaaaaz).Fooooooooooo.Fooooooooooo;
+  yield (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo.Fooooooooooo];
+}
+
+const foo32 = new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+function foo33() {
+  return new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz
+  )(Fooooooooooo.Fooooooooooo);
+}
+
+function foo34() {
+  throw new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz
+  )(Fooooooooooo.Fooooooooooo);
+}
+
+function foo35() {
+  void new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz
+  )(Fooooooooooo.Fooooooooooo);
+}
+
+foo36 = new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder =
+  askTrovenaBeenaDependsRowans +
+  ((glimseGlyphsHazardNoopsTieTie === 0
+    ? averredBathersBoxroomBuggyNurl
+    : anodyneCondosMalateOverateRetinol)[AnnularCooeedSplicesWalksWayWay]);
+
+bifornCringerMoshedPerplexSawder =
+  askTrovenaBeenaDependsRowans +
+  ((glimseGlyphsHazardNoopsTieTie === 0 &&
+  kochabCooieGameOnOboleUnweave === Math.PI
+    ? averredBathersBoxroomBuggyNurl
+    : anodyneCondosMalateOverateRetinol)[AnnularCooeedSplicesWalksWayWay]);
+
+bifornCringerMoshedPerplexSawder =
+  askTrovenaBeenaDependsRowans +
+  ((glimseGlyphsHazardNoopsTieTie === 0
+    ? averredBathersBoxroomBuggyNurl
+    : anodyneCondosMalateOverateRetinol).Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder =
+  askTrovenaBeenaDependsRowans +
+  ((glimseGlyphsHazardNoopsTieTie === 0 &&
+  kochabCooieGameOnOboleUnweave === Math.PI
+    ? averredBathersBoxroomBuggyNurl
+    : anodyneCondosMalateOverateRetinol).Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder =
+    askTrovenaBeenaDependsRowans +
+    ((glimseGlyphsHazardNoopsTieTie === 0
+      ? averredBathersBoxroomBuggyNurl
+      : anodyneCondosMalateOverateRetinol)(Fooooooooooo.Fooooooooooo));
+
+bifornCringerMoshedPerplexSawder =
+    askTrovenaBeenaDependsRowans +
+    ((glimseGlyphsHazardNoopsTieTie === 0 &&
+    kochabCooieGameOnOboleUnweave === Math.PI
+      ? averredBathersBoxroomBuggyNurl
+      : anodyneCondosMalateOverateRetinol)(Fooooooooooo.Fooooooooooo));
+
+bifornCringerMoshedPerplexSawder = (
+  glimseGlyphsHazardNoopsTieTie === 0 &&
+  kochabCooieGameOnOboleUnweave === Math.PI
+    ? averredBathersBoxroomBuggyNurl
+    : anodyneCondosMalateOverateRetinol
+  ).annularCooeedSplicesWalksWayWay
+    .annularCooeedSplicesWalksWayWay(annularCooeedSplicesWalksWayWay)
+    .annularCooeedSplicesWalksWayWay();
+
+foo = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz)?.()?.()?.();
+
+foo = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz)()()();
+
+foo =
+  foo.bar.baz[
+    coooooooooooooooooooooooooooooooooooooooooooooooooooond
+      ? baaaaaaaaaaaaaaaaaaaaar
+      : baaaaaaaaaaaaaaaaaaaaaz
+  ];
+
+const decorated = (arg, ignoreRequestError) => {
+  return (
+    typeof arg === "string" ||
+    (arg && arg.valueOf && typeof arg.valueOf() === "string")
+      ? $delegate(arg, ignoreRequestError)
+      : handleAsyncOperations(arg, ignoreRequestError)
+  ).foo();
+};
+
+=====================================output=====================================
+foo7 = (
+    coooooooooooooooooooooooooooooooooooooooooooooooooooond
+        ? baaaaaaaaaaaaaaaaaaaaar
+        : baaaaaaaaaaaaaaaaaaaaaz
+)[Fooooooooooo];
+
+foo8 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo9 = (
+    coooooooooooooooooooooooooooooooooooooooooooooooooooond
+        ? baaaaaaaaaaaaaaaaaaaaar
+        : baaaaaaaaaaaaaaaaaaaaaz
+)[Fooooooooooo];
+
+function foo10() {
+    return (
+        coooooooooooooooooooooooooooooooooooooooooooooooooooond
+            ? baaaaaaaaaaaaaaaaaaaaar
+            : baaaaaaaaaaaaaaaaaaaaaz
+    )[Fooooooooooo];
+}
+
+function foo11() {
+    throw (
+        coooooooooooooooooooooooooooooooooooooooooooooooooooond
+            ? baaaaaaaaaaaaaaaaaaaaar
+            : baaaaaaaaaaaaaaaaaaaaaz
+    )[Fooooooooooo];
+}
+
+function foo12() {
+    void (
+        coooooooooooooooooooooooooooooooooooooooooooooooooooond
+            ? baaaaaaaaaaaaaaaaaaaaar
+            : baaaaaaaaaaaaaaaaaaaaaz
+    )[Fooooooooooo];
+}
+
+foo13 = (
+    coooooooooooooooooooooooooooooooooooooooooooooooooooond
+        ? baaaaaaaaaaaaaaaaaaaaar
+        : baaaaaaaaaaaaaaaaaaaaaz
+).Fooooooooooo.Fooooooooooo;
+
+foo14 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo15 = (
+    coooooooooooooooooooooooooooooooooooooooooooooooooooond
+        ? baaaaaaaaaaaaaaaaaaaaar
+        : baaaaaaaaaaaaaaaaaaaaaz
+).Fooooooooooo.Fooooooooooo;
+
+function foo16() {
+    return (
+        coooooooooooooooooooooooooooooooooooooooooooooooooooond
+            ? baaaaaaaaaaaaaaaaaaaaar
+            : baaaaaaaaaaaaaaaaaaaaaz
+    ).Fooooooooooo.Fooooooooooo;
+}
+
+function foo17() {
+    throw (
+        coooooooooooooooooooooooooooooooooooooooooooooooooooond
+            ? baaaaaaaaaaaaaaaaaaaaar
+            : baaaaaaaaaaaaaaaaaaaaaz
+    ).Fooooooooooo.Fooooooooooo;
+}
+
+function foo18() {
+    void (
+        coooooooooooooooooooooooooooooooooooooooooooooooooooond
+            ? baaaaaaaaaaaaaaaaaaaaar
+            : baaaaaaaaaaaaaaaaaaaaaz
+    ).Fooooooooooo.Fooooooooooo;
+}
+
+foo19 = (
+    coooooooooooooooooooooooooooooooooooooooooooooooooooond
+        ? baaaaaaaaaaaaaaaaaaaaar
+        : baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+foo20 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo21 = (
+    coooooooooooooooooooooooooooooooooooooooooooooooooooond
+        ? baaaaaaaaaaaaaaaaaaaaar
+        : baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+function foo22() {
+    return (
+        coooooooooooooooooooooooooooooooooooooooooooooooooooond
+            ? baaaaaaaaaaaaaaaaaaaaar
+            : baaaaaaaaaaaaaaaaaaaaaz
+    )(Fooooooooooo.Fooooooooooo);
+}
+
+function foo23() {
+    throw (
+        coooooooooooooooooooooooooooooooooooooooooooooooooooond
+            ? baaaaaaaaaaaaaaaaaaaaar
+            : baaaaaaaaaaaaaaaaaaaaaz
+    )(Fooooooooooo.Fooooooooooo);
+}
+
+function foo24() {
+    void (
+        coooooooooooooooooooooooooooooooooooooooooooooooooooond
+            ? baaaaaaaaaaaaaaaaaaaaar
+            : baaaaaaaaaaaaaaaaaaaaaz
+    )(Fooooooooooo.Fooooooooooo);
+}
+
+foo25 = (
+    coooooooooooooooooooooooooooooooooooooooooooooooooooond
+        ? baaaaaaaaaaaaaaaaaaaaar
+        : baaaaaaaaaaaaaaaaaaaaaz
+)?.(Fooooooooooo.Fooooooooooo);
+
+foo26 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo27 = (
+    coooooooooooooooooooooooooooooooooooooooooooooooooooond
+        ? baaaaaaaaaaaaaaaaaaaaar
+        : baaaaaaaaaaaaaaaaaaaaaz
+)?.(Fooooooooooo.Fooooooooooo);
+
+function foo28() {
+    return (
+        coooooooooooooooooooooooooooooooooooooooooooooooooooond
+            ? baaaaaaaaaaaaaaaaaaaaar
+            : baaaaaaaaaaaaaaaaaaaaaz
+    )?.(Fooooooooooo.Fooooooooooo);
+}
+
+function foo29() {
+    throw (
+        coooooooooooooooooooooooooooooooooooooooooooooooooooond
+            ? baaaaaaaaaaaaaaaaaaaaar
+            : baaaaaaaaaaaaaaaaaaaaaz
+    )?.(Fooooooooooo.Fooooooooooo);
+}
+
+function foo30() {
+    void (
+        coooooooooooooooooooooooooooooooooooooooooooooooooooond
+            ? baaaaaaaaaaaaaaaaaaaaar
+            : baaaaaaaaaaaaaaaaaaaaaz
+    )?.(Fooooooooooo.Fooooooooooo);
+}
+
+function* foo31() {
+    yield (
+        coooooooooooooooooooooooooooooooooooooooooooooooooooond
+            ? baaaaaaaaaaaaaaaaaaaaar
+            : baaaaaaaaaaaaaaaaaaaaaz
+    )?.(Fooooooooooo.Fooooooooooo);
+    yield (
+        coooooooooooooooooooooooooooooooooooooooooooooooooooond
+            ? baaaaaaaaaaaaaaaaaaaaar
+            : baaaaaaaaaaaaaaaaaaaaaz
+    )(Fooooooooooo.Fooooooooooo);
+    yield (
+        coooooooooooooooooooooooooooooooooooooooooooooooooooond
+            ? baaaaaaaaaaaaaaaaaaaaar
+            : baaaaaaaaaaaaaaaaaaaaaz
+    ).Fooooooooooo.Fooooooooooo;
+    yield (
+        coooooooooooooooooooooooooooooooooooooooooooooooooooond
+            ? baaaaaaaaaaaaaaaaaaaaar
+            : baaaaaaaaaaaaaaaaaaaaaz
+    )[Fooooooooooo.Fooooooooooo];
+}
+
+const foo32 = new (
+    coooooooooooooooooooooooooooooooooooooooooooooooooooond
+        ? baaaaaaaaaaaaaaaaaaaaar
+        : baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+function foo33() {
+    return new (
+        coooooooooooooooooooooooooooooooooooooooooooooooooooond
+            ? baaaaaaaaaaaaaaaaaaaaar
+            : baaaaaaaaaaaaaaaaaaaaaz
+    )(Fooooooooooo.Fooooooooooo);
+}
+
+function foo34() {
+    throw new (
+        coooooooooooooooooooooooooooooooooooooooooooooooooooond
+            ? baaaaaaaaaaaaaaaaaaaaar
+            : baaaaaaaaaaaaaaaaaaaaaz
+    )(Fooooooooooo.Fooooooooooo);
+}
+
+function foo35() {
+    void new (
+        coooooooooooooooooooooooooooooooooooooooooooooooooooond
+            ? baaaaaaaaaaaaaaaaaaaaar
+            : baaaaaaaaaaaaaaaaaaaaaz
+    )(Fooooooooooo.Fooooooooooo);
+}
+
+foo36 = new (
+    coooooooooooooooooooooooooooooooooooooooooooooooooooond
+        ? baaaaaaaaaaaaaaaaaaaaar
+        : baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder =
+    askTrovenaBeenaDependsRowans +
+    (glimseGlyphsHazardNoopsTieTie === 0
+        ? averredBathersBoxroomBuggyNurl
+        : anodyneCondosMalateOverateRetinol)[AnnularCooeedSplicesWalksWayWay];
+
+bifornCringerMoshedPerplexSawder =
+    askTrovenaBeenaDependsRowans +
+    (glimseGlyphsHazardNoopsTieTie === 0 &&
+    kochabCooieGameOnOboleUnweave === Math.PI
+        ? averredBathersBoxroomBuggyNurl
+        : anodyneCondosMalateOverateRetinol)[AnnularCooeedSplicesWalksWayWay];
+
+bifornCringerMoshedPerplexSawder =
+    askTrovenaBeenaDependsRowans +
+    (glimseGlyphsHazardNoopsTieTie === 0
+        ? averredBathersBoxroomBuggyNurl
+        : anodyneCondosMalateOverateRetinol
+    ).Fooooooooooo.Fooooooooooo;
+
+bifornCringerMoshedPerplexSawder =
+    askTrovenaBeenaDependsRowans +
+    (glimseGlyphsHazardNoopsTieTie === 0 &&
+    kochabCooieGameOnOboleUnweave === Math.PI
+        ? averredBathersBoxroomBuggyNurl
+        : anodyneCondosMalateOverateRetinol
+    ).Fooooooooooo.Fooooooooooo;
+
+bifornCringerMoshedPerplexSawder =
+    askTrovenaBeenaDependsRowans +
+    (glimseGlyphsHazardNoopsTieTie === 0
+        ? averredBathersBoxroomBuggyNurl
+        : anodyneCondosMalateOverateRetinol)(Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder =
+    askTrovenaBeenaDependsRowans +
+    (glimseGlyphsHazardNoopsTieTie === 0 &&
+        kochabCooieGameOnOboleUnweave === Math.PI
+        ? averredBathersBoxroomBuggyNurl
+        : anodyneCondosMalateOverateRetinol)(Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder = (
+    glimseGlyphsHazardNoopsTieTie === 0 &&
+    kochabCooieGameOnOboleUnweave === Math.PI
+        ? averredBathersBoxroomBuggyNurl
+        : anodyneCondosMalateOverateRetinol
+).annularCooeedSplicesWalksWayWay
+    .annularCooeedSplicesWalksWayWay(annularCooeedSplicesWalksWayWay)
+    .annularCooeedSplicesWalksWayWay();
+
+foo = (
+    coooooooooooooooooooooooooooooooooooooooooooooooooooond
+        ? baaaaaaaaaaaaaaaaaaaaar
+        : baaaaaaaaaaaaaaaaaaaaaz
+)?.()?.()?.();
+
+foo = (
+    coooooooooooooooooooooooooooooooooooooooooooooooooooond
+        ? baaaaaaaaaaaaaaaaaaaaar
+        : baaaaaaaaaaaaaaaaaaaaaz
+)()()();
+
+foo =
+    foo.bar.baz[
+        coooooooooooooooooooooooooooooooooooooooooooooooooooond
+            ? baaaaaaaaaaaaaaaaaaaaar
+            : baaaaaaaaaaaaaaaaaaaaaz
+    ];
+
+const decorated = (arg, ignoreRequestError) => {
+    return (
+        typeof arg === "string" ||
+        (arg && arg.valueOf && typeof arg.valueOf() === "string")
+            ? $delegate(arg, ignoreRequestError)
+            : handleAsyncOperations(arg, ignoreRequestError)
+    ).foo();
+};
+
+================================================================================
+`;
+
+exports[`indent-after-paren.js - {"useTabs":true,"tabWidth":4} format 1`] = `
+====================================options=====================================
+parsers: ["babel", "flow", "typescript"]
+printWidth: 80
+tabWidth: 4
+useTabs: true
+                                                                                | printWidth
+=====================================input======================================
+foo7 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+
+foo8 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo9 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+
+function foo10() {
+  return (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+}
+
+function foo11() {
+  throw (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+}
+
+function foo12() {
+  void (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+}
+
+foo13 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz
+).Fooooooooooo.Fooooooooooo;
+
+foo14 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo15 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz
+).Fooooooooooo.Fooooooooooo;
+
+function foo16() {
+  return (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz
+  ).Fooooooooooo.Fooooooooooo;
+}
+
+function foo17() {
+  throw (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz
+  ).Fooooooooooo.Fooooooooooo;
+}
+
+function foo18() {
+  void (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz
+  ).Fooooooooooo.Fooooooooooo;
+}
+
+foo19 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+
+foo20 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo21 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+
+function foo22() {
+  return (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+}
+
+function foo23() {
+  throw (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+}
+
+function foo24() {
+  void (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+}
+
+foo25 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+
+foo26 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo27 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+
+function foo28() {
+  return (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+}
+
+function foo29() {
+  throw (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+}
+
+function foo30() {
+  void (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+}
+
+function* foo31() {
+  yield (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+  yield (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+      ? baaaaaaaaaaaaaaaaaaaaar
+      : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+  yield (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+      ? baaaaaaaaaaaaaaaaaaaaar
+      : baaaaaaaaaaaaaaaaaaaaaz).Fooooooooooo.Fooooooooooo;
+  yield (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo.Fooooooooooo];
+}
+
+const foo32 = new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+function foo33() {
+  return new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz
+  )(Fooooooooooo.Fooooooooooo);
+}
+
+function foo34() {
+  throw new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz
+  )(Fooooooooooo.Fooooooooooo);
+}
+
+function foo35() {
+  void new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz
+  )(Fooooooooooo.Fooooooooooo);
+}
+
+foo36 = new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder =
+  askTrovenaBeenaDependsRowans +
+  ((glimseGlyphsHazardNoopsTieTie === 0
+    ? averredBathersBoxroomBuggyNurl
+    : anodyneCondosMalateOverateRetinol)[AnnularCooeedSplicesWalksWayWay]);
+
+bifornCringerMoshedPerplexSawder =
+  askTrovenaBeenaDependsRowans +
+  ((glimseGlyphsHazardNoopsTieTie === 0 &&
+  kochabCooieGameOnOboleUnweave === Math.PI
+    ? averredBathersBoxroomBuggyNurl
+    : anodyneCondosMalateOverateRetinol)[AnnularCooeedSplicesWalksWayWay]);
+
+bifornCringerMoshedPerplexSawder =
+  askTrovenaBeenaDependsRowans +
+  ((glimseGlyphsHazardNoopsTieTie === 0
+    ? averredBathersBoxroomBuggyNurl
+    : anodyneCondosMalateOverateRetinol).Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder =
+  askTrovenaBeenaDependsRowans +
+  ((glimseGlyphsHazardNoopsTieTie === 0 &&
+  kochabCooieGameOnOboleUnweave === Math.PI
+    ? averredBathersBoxroomBuggyNurl
+    : anodyneCondosMalateOverateRetinol).Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder =
+    askTrovenaBeenaDependsRowans +
+    ((glimseGlyphsHazardNoopsTieTie === 0
+      ? averredBathersBoxroomBuggyNurl
+      : anodyneCondosMalateOverateRetinol)(Fooooooooooo.Fooooooooooo));
+
+bifornCringerMoshedPerplexSawder =
+    askTrovenaBeenaDependsRowans +
+    ((glimseGlyphsHazardNoopsTieTie === 0 &&
+    kochabCooieGameOnOboleUnweave === Math.PI
+      ? averredBathersBoxroomBuggyNurl
+      : anodyneCondosMalateOverateRetinol)(Fooooooooooo.Fooooooooooo));
+
+bifornCringerMoshedPerplexSawder = (
+  glimseGlyphsHazardNoopsTieTie === 0 &&
+  kochabCooieGameOnOboleUnweave === Math.PI
+    ? averredBathersBoxroomBuggyNurl
+    : anodyneCondosMalateOverateRetinol
+  ).annularCooeedSplicesWalksWayWay
+    .annularCooeedSplicesWalksWayWay(annularCooeedSplicesWalksWayWay)
+    .annularCooeedSplicesWalksWayWay();
+
+foo = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz)?.()?.()?.();
+
+foo = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz)()()();
+
+foo =
+  foo.bar.baz[
+    coooooooooooooooooooooooooooooooooooooooooooooooooooond
+      ? baaaaaaaaaaaaaaaaaaaaar
+      : baaaaaaaaaaaaaaaaaaaaaz
+  ];
+
+const decorated = (arg, ignoreRequestError) => {
+  return (
+    typeof arg === "string" ||
+    (arg && arg.valueOf && typeof arg.valueOf() === "string")
+      ? $delegate(arg, ignoreRequestError)
+      : handleAsyncOperations(arg, ignoreRequestError)
+  ).foo();
+};
+
+=====================================output=====================================
+foo7 = (
+	coooooooooooooooooooooooooooooooooooooooooooooooooooond
+		? baaaaaaaaaaaaaaaaaaaaar
+		: baaaaaaaaaaaaaaaaaaaaaz
+)[Fooooooooooo];
+
+foo8 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo9 = (
+	coooooooooooooooooooooooooooooooooooooooooooooooooooond
+		? baaaaaaaaaaaaaaaaaaaaar
+		: baaaaaaaaaaaaaaaaaaaaaz
+)[Fooooooooooo];
+
+function foo10() {
+	return (
+		coooooooooooooooooooooooooooooooooooooooooooooooooooond
+			? baaaaaaaaaaaaaaaaaaaaar
+			: baaaaaaaaaaaaaaaaaaaaaz
+	)[Fooooooooooo];
+}
+
+function foo11() {
+	throw (
+		coooooooooooooooooooooooooooooooooooooooooooooooooooond
+			? baaaaaaaaaaaaaaaaaaaaar
+			: baaaaaaaaaaaaaaaaaaaaaz
+	)[Fooooooooooo];
+}
+
+function foo12() {
+	void (
+		coooooooooooooooooooooooooooooooooooooooooooooooooooond
+			? baaaaaaaaaaaaaaaaaaaaar
+			: baaaaaaaaaaaaaaaaaaaaaz
+	)[Fooooooooooo];
+}
+
+foo13 = (
+	coooooooooooooooooooooooooooooooooooooooooooooooooooond
+		? baaaaaaaaaaaaaaaaaaaaar
+		: baaaaaaaaaaaaaaaaaaaaaz
+).Fooooooooooo.Fooooooooooo;
+
+foo14 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo15 = (
+	coooooooooooooooooooooooooooooooooooooooooooooooooooond
+		? baaaaaaaaaaaaaaaaaaaaar
+		: baaaaaaaaaaaaaaaaaaaaaz
+).Fooooooooooo.Fooooooooooo;
+
+function foo16() {
+	return (
+		coooooooooooooooooooooooooooooooooooooooooooooooooooond
+			? baaaaaaaaaaaaaaaaaaaaar
+			: baaaaaaaaaaaaaaaaaaaaaz
+	).Fooooooooooo.Fooooooooooo;
+}
+
+function foo17() {
+	throw (
+		coooooooooooooooooooooooooooooooooooooooooooooooooooond
+			? baaaaaaaaaaaaaaaaaaaaar
+			: baaaaaaaaaaaaaaaaaaaaaz
+	).Fooooooooooo.Fooooooooooo;
+}
+
+function foo18() {
+	void (
+		coooooooooooooooooooooooooooooooooooooooooooooooooooond
+			? baaaaaaaaaaaaaaaaaaaaar
+			: baaaaaaaaaaaaaaaaaaaaaz
+	).Fooooooooooo.Fooooooooooo;
+}
+
+foo19 = (
+	coooooooooooooooooooooooooooooooooooooooooooooooooooond
+		? baaaaaaaaaaaaaaaaaaaaar
+		: baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+foo20 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo21 = (
+	coooooooooooooooooooooooooooooooooooooooooooooooooooond
+		? baaaaaaaaaaaaaaaaaaaaar
+		: baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+function foo22() {
+	return (
+		coooooooooooooooooooooooooooooooooooooooooooooooooooond
+			? baaaaaaaaaaaaaaaaaaaaar
+			: baaaaaaaaaaaaaaaaaaaaaz
+	)(Fooooooooooo.Fooooooooooo);
+}
+
+function foo23() {
+	throw (
+		coooooooooooooooooooooooooooooooooooooooooooooooooooond
+			? baaaaaaaaaaaaaaaaaaaaar
+			: baaaaaaaaaaaaaaaaaaaaaz
+	)(Fooooooooooo.Fooooooooooo);
+}
+
+function foo24() {
+	void (
+		coooooooooooooooooooooooooooooooooooooooooooooooooooond
+			? baaaaaaaaaaaaaaaaaaaaar
+			: baaaaaaaaaaaaaaaaaaaaaz
+	)(Fooooooooooo.Fooooooooooo);
+}
+
+foo25 = (
+	coooooooooooooooooooooooooooooooooooooooooooooooooooond
+		? baaaaaaaaaaaaaaaaaaaaar
+		: baaaaaaaaaaaaaaaaaaaaaz
+)?.(Fooooooooooo.Fooooooooooo);
+
+foo26 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo27 = (
+	coooooooooooooooooooooooooooooooooooooooooooooooooooond
+		? baaaaaaaaaaaaaaaaaaaaar
+		: baaaaaaaaaaaaaaaaaaaaaz
+)?.(Fooooooooooo.Fooooooooooo);
+
+function foo28() {
+	return (
+		coooooooooooooooooooooooooooooooooooooooooooooooooooond
+			? baaaaaaaaaaaaaaaaaaaaar
+			: baaaaaaaaaaaaaaaaaaaaaz
+	)?.(Fooooooooooo.Fooooooooooo);
+}
+
+function foo29() {
+	throw (
+		coooooooooooooooooooooooooooooooooooooooooooooooooooond
+			? baaaaaaaaaaaaaaaaaaaaar
+			: baaaaaaaaaaaaaaaaaaaaaz
+	)?.(Fooooooooooo.Fooooooooooo);
+}
+
+function foo30() {
+	void (
+		coooooooooooooooooooooooooooooooooooooooooooooooooooond
+			? baaaaaaaaaaaaaaaaaaaaar
+			: baaaaaaaaaaaaaaaaaaaaaz
+	)?.(Fooooooooooo.Fooooooooooo);
+}
+
+function* foo31() {
+	yield (
+		coooooooooooooooooooooooooooooooooooooooooooooooooooond
+			? baaaaaaaaaaaaaaaaaaaaar
+			: baaaaaaaaaaaaaaaaaaaaaz
+	)?.(Fooooooooooo.Fooooooooooo);
+	yield (
+		coooooooooooooooooooooooooooooooooooooooooooooooooooond
+			? baaaaaaaaaaaaaaaaaaaaar
+			: baaaaaaaaaaaaaaaaaaaaaz
+	)(Fooooooooooo.Fooooooooooo);
+	yield (
+		coooooooooooooooooooooooooooooooooooooooooooooooooooond
+			? baaaaaaaaaaaaaaaaaaaaar
+			: baaaaaaaaaaaaaaaaaaaaaz
+	).Fooooooooooo.Fooooooooooo;
+	yield (
+		coooooooooooooooooooooooooooooooooooooooooooooooooooond
+			? baaaaaaaaaaaaaaaaaaaaar
+			: baaaaaaaaaaaaaaaaaaaaaz
+	)[Fooooooooooo.Fooooooooooo];
+}
+
+const foo32 = new (
+	coooooooooooooooooooooooooooooooooooooooooooooooooooond
+		? baaaaaaaaaaaaaaaaaaaaar
+		: baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+function foo33() {
+	return new (
+		coooooooooooooooooooooooooooooooooooooooooooooooooooond
+			? baaaaaaaaaaaaaaaaaaaaar
+			: baaaaaaaaaaaaaaaaaaaaaz
+	)(Fooooooooooo.Fooooooooooo);
+}
+
+function foo34() {
+	throw new (
+		coooooooooooooooooooooooooooooooooooooooooooooooooooond
+			? baaaaaaaaaaaaaaaaaaaaar
+			: baaaaaaaaaaaaaaaaaaaaaz
+	)(Fooooooooooo.Fooooooooooo);
+}
+
+function foo35() {
+	void new (
+		coooooooooooooooooooooooooooooooooooooooooooooooooooond
+			? baaaaaaaaaaaaaaaaaaaaar
+			: baaaaaaaaaaaaaaaaaaaaaz
+	)(Fooooooooooo.Fooooooooooo);
+}
+
+foo36 = new (
+	coooooooooooooooooooooooooooooooooooooooooooooooooooond
+		? baaaaaaaaaaaaaaaaaaaaar
+		: baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder =
+	askTrovenaBeenaDependsRowans +
+	(glimseGlyphsHazardNoopsTieTie === 0
+		? averredBathersBoxroomBuggyNurl
+		: anodyneCondosMalateOverateRetinol)[AnnularCooeedSplicesWalksWayWay];
+
+bifornCringerMoshedPerplexSawder =
+	askTrovenaBeenaDependsRowans +
+	(glimseGlyphsHazardNoopsTieTie === 0 &&
+	kochabCooieGameOnOboleUnweave === Math.PI
+		? averredBathersBoxroomBuggyNurl
+		: anodyneCondosMalateOverateRetinol)[AnnularCooeedSplicesWalksWayWay];
+
+bifornCringerMoshedPerplexSawder =
+	askTrovenaBeenaDependsRowans +
+	(glimseGlyphsHazardNoopsTieTie === 0
+		? averredBathersBoxroomBuggyNurl
+		: anodyneCondosMalateOverateRetinol
+	).Fooooooooooo.Fooooooooooo;
+
+bifornCringerMoshedPerplexSawder =
+	askTrovenaBeenaDependsRowans +
+	(glimseGlyphsHazardNoopsTieTie === 0 &&
+	kochabCooieGameOnOboleUnweave === Math.PI
+		? averredBathersBoxroomBuggyNurl
+		: anodyneCondosMalateOverateRetinol
+	).Fooooooooooo.Fooooooooooo;
+
+bifornCringerMoshedPerplexSawder =
+	askTrovenaBeenaDependsRowans +
+	(glimseGlyphsHazardNoopsTieTie === 0
+		? averredBathersBoxroomBuggyNurl
+		: anodyneCondosMalateOverateRetinol)(Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder =
+	askTrovenaBeenaDependsRowans +
+	(glimseGlyphsHazardNoopsTieTie === 0 &&
+		kochabCooieGameOnOboleUnweave === Math.PI
+		? averredBathersBoxroomBuggyNurl
+		: anodyneCondosMalateOverateRetinol)(Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder = (
+	glimseGlyphsHazardNoopsTieTie === 0 &&
+	kochabCooieGameOnOboleUnweave === Math.PI
+		? averredBathersBoxroomBuggyNurl
+		: anodyneCondosMalateOverateRetinol
+).annularCooeedSplicesWalksWayWay
+	.annularCooeedSplicesWalksWayWay(annularCooeedSplicesWalksWayWay)
+	.annularCooeedSplicesWalksWayWay();
+
+foo = (
+	coooooooooooooooooooooooooooooooooooooooooooooooooooond
+		? baaaaaaaaaaaaaaaaaaaaar
+		: baaaaaaaaaaaaaaaaaaaaaz
+)?.()?.()?.();
+
+foo = (
+	coooooooooooooooooooooooooooooooooooooooooooooooooooond
+		? baaaaaaaaaaaaaaaaaaaaar
+		: baaaaaaaaaaaaaaaaaaaaaz
+)()()();
+
+foo =
+	foo.bar.baz[
+		coooooooooooooooooooooooooooooooooooooooooooooooooooond
+			? baaaaaaaaaaaaaaaaaaaaar
+			: baaaaaaaaaaaaaaaaaaaaaz
+	];
+
+const decorated = (arg, ignoreRequestError) => {
+	return (
+		typeof arg === "string" ||
+		(arg && arg.valueOf && typeof arg.valueOf() === "string")
+			? $delegate(arg, ignoreRequestError)
+			: handleAsyncOperations(arg, ignoreRequestError)
+	).foo();
+};
+
+================================================================================
+`;
+
+exports[`indent-after-paren.js - {"useTabs":true} format 1`] = `
+====================================options=====================================
+parsers: ["babel", "flow", "typescript"]
+printWidth: 80
+useTabs: true
+                                                                                | printWidth
+=====================================input======================================
+foo7 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+
+foo8 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo9 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+
+function foo10() {
+  return (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+}
+
+function foo11() {
+  throw (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+}
+
+function foo12() {
+  void (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+}
+
+foo13 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz
+).Fooooooooooo.Fooooooooooo;
+
+foo14 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo15 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz
+).Fooooooooooo.Fooooooooooo;
+
+function foo16() {
+  return (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz
+  ).Fooooooooooo.Fooooooooooo;
+}
+
+function foo17() {
+  throw (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz
+  ).Fooooooooooo.Fooooooooooo;
+}
+
+function foo18() {
+  void (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz
+  ).Fooooooooooo.Fooooooooooo;
+}
+
+foo19 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+
+foo20 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo21 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+
+function foo22() {
+  return (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+}
+
+function foo23() {
+  throw (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+}
+
+function foo24() {
+  void (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+}
+
+foo25 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+
+foo26 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo27 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+
+function foo28() {
+  return (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+}
+
+function foo29() {
+  throw (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+}
+
+function foo30() {
+  void (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+}
+
+function* foo31() {
+  yield (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+  yield (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+      ? baaaaaaaaaaaaaaaaaaaaar
+      : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+  yield (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+      ? baaaaaaaaaaaaaaaaaaaaar
+      : baaaaaaaaaaaaaaaaaaaaaz).Fooooooooooo.Fooooooooooo;
+  yield (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo.Fooooooooooo];
+}
+
+const foo32 = new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+function foo33() {
+  return new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz
+  )(Fooooooooooo.Fooooooooooo);
+}
+
+function foo34() {
+  throw new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz
+  )(Fooooooooooo.Fooooooooooo);
+}
+
+function foo35() {
+  void new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz
+  )(Fooooooooooo.Fooooooooooo);
+}
+
+foo36 = new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder =
+  askTrovenaBeenaDependsRowans +
+  ((glimseGlyphsHazardNoopsTieTie === 0
+    ? averredBathersBoxroomBuggyNurl
+    : anodyneCondosMalateOverateRetinol)[AnnularCooeedSplicesWalksWayWay]);
+
+bifornCringerMoshedPerplexSawder =
+  askTrovenaBeenaDependsRowans +
+  ((glimseGlyphsHazardNoopsTieTie === 0 &&
+  kochabCooieGameOnOboleUnweave === Math.PI
+    ? averredBathersBoxroomBuggyNurl
+    : anodyneCondosMalateOverateRetinol)[AnnularCooeedSplicesWalksWayWay]);
+
+bifornCringerMoshedPerplexSawder =
+  askTrovenaBeenaDependsRowans +
+  ((glimseGlyphsHazardNoopsTieTie === 0
+    ? averredBathersBoxroomBuggyNurl
+    : anodyneCondosMalateOverateRetinol).Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder =
+  askTrovenaBeenaDependsRowans +
+  ((glimseGlyphsHazardNoopsTieTie === 0 &&
+  kochabCooieGameOnOboleUnweave === Math.PI
+    ? averredBathersBoxroomBuggyNurl
+    : anodyneCondosMalateOverateRetinol).Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder =
+    askTrovenaBeenaDependsRowans +
+    ((glimseGlyphsHazardNoopsTieTie === 0
+      ? averredBathersBoxroomBuggyNurl
+      : anodyneCondosMalateOverateRetinol)(Fooooooooooo.Fooooooooooo));
+
+bifornCringerMoshedPerplexSawder =
+    askTrovenaBeenaDependsRowans +
+    ((glimseGlyphsHazardNoopsTieTie === 0 &&
+    kochabCooieGameOnOboleUnweave === Math.PI
+      ? averredBathersBoxroomBuggyNurl
+      : anodyneCondosMalateOverateRetinol)(Fooooooooooo.Fooooooooooo));
+
+bifornCringerMoshedPerplexSawder = (
+  glimseGlyphsHazardNoopsTieTie === 0 &&
+  kochabCooieGameOnOboleUnweave === Math.PI
+    ? averredBathersBoxroomBuggyNurl
+    : anodyneCondosMalateOverateRetinol
+  ).annularCooeedSplicesWalksWayWay
+    .annularCooeedSplicesWalksWayWay(annularCooeedSplicesWalksWayWay)
+    .annularCooeedSplicesWalksWayWay();
+
+foo = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz)?.()?.()?.();
+
+foo = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz)()()();
+
+foo =
+  foo.bar.baz[
+    coooooooooooooooooooooooooooooooooooooooooooooooooooond
+      ? baaaaaaaaaaaaaaaaaaaaar
+      : baaaaaaaaaaaaaaaaaaaaaz
+  ];
+
+const decorated = (arg, ignoreRequestError) => {
+  return (
+    typeof arg === "string" ||
+    (arg && arg.valueOf && typeof arg.valueOf() === "string")
+      ? $delegate(arg, ignoreRequestError)
+      : handleAsyncOperations(arg, ignoreRequestError)
+  ).foo();
+};
+
+=====================================output=====================================
+foo7 = (
+	coooooooooooooooooooooooooooooooooooooooooooooooooooond
+		? baaaaaaaaaaaaaaaaaaaaar
+		: baaaaaaaaaaaaaaaaaaaaaz
+)[Fooooooooooo];
+
+foo8 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo9 = (
+	coooooooooooooooooooooooooooooooooooooooooooooooooooond
+		? baaaaaaaaaaaaaaaaaaaaar
+		: baaaaaaaaaaaaaaaaaaaaaz
+)[Fooooooooooo];
+
+function foo10() {
+	return (
+		coooooooooooooooooooooooooooooooooooooooooooooooooooond
+			? baaaaaaaaaaaaaaaaaaaaar
+			: baaaaaaaaaaaaaaaaaaaaaz
+	)[Fooooooooooo];
+}
+
+function foo11() {
+	throw (
+		coooooooooooooooooooooooooooooooooooooooooooooooooooond
+			? baaaaaaaaaaaaaaaaaaaaar
+			: baaaaaaaaaaaaaaaaaaaaaz
+	)[Fooooooooooo];
+}
+
+function foo12() {
+	void (
+		coooooooooooooooooooooooooooooooooooooooooooooooooooond
+			? baaaaaaaaaaaaaaaaaaaaar
+			: baaaaaaaaaaaaaaaaaaaaaz
+	)[Fooooooooooo];
+}
+
+foo13 = (
+	coooooooooooooooooooooooooooooooooooooooooooooooooooond
+		? baaaaaaaaaaaaaaaaaaaaar
+		: baaaaaaaaaaaaaaaaaaaaaz
+).Fooooooooooo.Fooooooooooo;
+
+foo14 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo15 = (
+	coooooooooooooooooooooooooooooooooooooooooooooooooooond
+		? baaaaaaaaaaaaaaaaaaaaar
+		: baaaaaaaaaaaaaaaaaaaaaz
+).Fooooooooooo.Fooooooooooo;
+
+function foo16() {
+	return (
+		coooooooooooooooooooooooooooooooooooooooooooooooooooond
+			? baaaaaaaaaaaaaaaaaaaaar
+			: baaaaaaaaaaaaaaaaaaaaaz
+	).Fooooooooooo.Fooooooooooo;
+}
+
+function foo17() {
+	throw (
+		coooooooooooooooooooooooooooooooooooooooooooooooooooond
+			? baaaaaaaaaaaaaaaaaaaaar
+			: baaaaaaaaaaaaaaaaaaaaaz
+	).Fooooooooooo.Fooooooooooo;
+}
+
+function foo18() {
+	void (
+		coooooooooooooooooooooooooooooooooooooooooooooooooooond
+			? baaaaaaaaaaaaaaaaaaaaar
+			: baaaaaaaaaaaaaaaaaaaaaz
+	).Fooooooooooo.Fooooooooooo;
+}
+
+foo19 = (
+	coooooooooooooooooooooooooooooooooooooooooooooooooooond
+		? baaaaaaaaaaaaaaaaaaaaar
+		: baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+foo20 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo21 = (
+	coooooooooooooooooooooooooooooooooooooooooooooooooooond
+		? baaaaaaaaaaaaaaaaaaaaar
+		: baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+function foo22() {
+	return (
+		coooooooooooooooooooooooooooooooooooooooooooooooooooond
+			? baaaaaaaaaaaaaaaaaaaaar
+			: baaaaaaaaaaaaaaaaaaaaaz
+	)(Fooooooooooo.Fooooooooooo);
+}
+
+function foo23() {
+	throw (
+		coooooooooooooooooooooooooooooooooooooooooooooooooooond
+			? baaaaaaaaaaaaaaaaaaaaar
+			: baaaaaaaaaaaaaaaaaaaaaz
+	)(Fooooooooooo.Fooooooooooo);
+}
+
+function foo24() {
+	void (
+		coooooooooooooooooooooooooooooooooooooooooooooooooooond
+			? baaaaaaaaaaaaaaaaaaaaar
+			: baaaaaaaaaaaaaaaaaaaaaz
+	)(Fooooooooooo.Fooooooooooo);
+}
+
+foo25 = (
+	coooooooooooooooooooooooooooooooooooooooooooooooooooond
+		? baaaaaaaaaaaaaaaaaaaaar
+		: baaaaaaaaaaaaaaaaaaaaaz
+)?.(Fooooooooooo.Fooooooooooo);
+
+foo26 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo27 = (
+	coooooooooooooooooooooooooooooooooooooooooooooooooooond
+		? baaaaaaaaaaaaaaaaaaaaar
+		: baaaaaaaaaaaaaaaaaaaaaz
+)?.(Fooooooooooo.Fooooooooooo);
+
+function foo28() {
+	return (
+		coooooooooooooooooooooooooooooooooooooooooooooooooooond
+			? baaaaaaaaaaaaaaaaaaaaar
+			: baaaaaaaaaaaaaaaaaaaaaz
+	)?.(Fooooooooooo.Fooooooooooo);
+}
+
+function foo29() {
+	throw (
+		coooooooooooooooooooooooooooooooooooooooooooooooooooond
+			? baaaaaaaaaaaaaaaaaaaaar
+			: baaaaaaaaaaaaaaaaaaaaaz
+	)?.(Fooooooooooo.Fooooooooooo);
+}
+
+function foo30() {
+	void (
+		coooooooooooooooooooooooooooooooooooooooooooooooooooond
+			? baaaaaaaaaaaaaaaaaaaaar
+			: baaaaaaaaaaaaaaaaaaaaaz
+	)?.(Fooooooooooo.Fooooooooooo);
+}
+
+function* foo31() {
+	yield (
+		coooooooooooooooooooooooooooooooooooooooooooooooooooond
+			? baaaaaaaaaaaaaaaaaaaaar
+			: baaaaaaaaaaaaaaaaaaaaaz
+	)?.(Fooooooooooo.Fooooooooooo);
+	yield (
+		coooooooooooooooooooooooooooooooooooooooooooooooooooond
+			? baaaaaaaaaaaaaaaaaaaaar
+			: baaaaaaaaaaaaaaaaaaaaaz
+	)(Fooooooooooo.Fooooooooooo);
+	yield (
+		coooooooooooooooooooooooooooooooooooooooooooooooooooond
+			? baaaaaaaaaaaaaaaaaaaaar
+			: baaaaaaaaaaaaaaaaaaaaaz
+	).Fooooooooooo.Fooooooooooo;
+	yield (
+		coooooooooooooooooooooooooooooooooooooooooooooooooooond
+			? baaaaaaaaaaaaaaaaaaaaar
+			: baaaaaaaaaaaaaaaaaaaaaz
+	)[Fooooooooooo.Fooooooooooo];
+}
+
+const foo32 = new (
+	coooooooooooooooooooooooooooooooooooooooooooooooooooond
+		? baaaaaaaaaaaaaaaaaaaaar
+		: baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+function foo33() {
+	return new (
+		coooooooooooooooooooooooooooooooooooooooooooooooooooond
+			? baaaaaaaaaaaaaaaaaaaaar
+			: baaaaaaaaaaaaaaaaaaaaaz
+	)(Fooooooooooo.Fooooooooooo);
+}
+
+function foo34() {
+	throw new (
+		coooooooooooooooooooooooooooooooooooooooooooooooooooond
+			? baaaaaaaaaaaaaaaaaaaaar
+			: baaaaaaaaaaaaaaaaaaaaaz
+	)(Fooooooooooo.Fooooooooooo);
+}
+
+function foo35() {
+	void new (
+		coooooooooooooooooooooooooooooooooooooooooooooooooooond
+			? baaaaaaaaaaaaaaaaaaaaar
+			: baaaaaaaaaaaaaaaaaaaaaz
+	)(Fooooooooooo.Fooooooooooo);
+}
+
+foo36 = new (
+	coooooooooooooooooooooooooooooooooooooooooooooooooooond
+		? baaaaaaaaaaaaaaaaaaaaar
+		: baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder =
+	askTrovenaBeenaDependsRowans +
+	(glimseGlyphsHazardNoopsTieTie === 0
+		? averredBathersBoxroomBuggyNurl
+		: anodyneCondosMalateOverateRetinol)[AnnularCooeedSplicesWalksWayWay];
+
+bifornCringerMoshedPerplexSawder =
+	askTrovenaBeenaDependsRowans +
+	(glimseGlyphsHazardNoopsTieTie === 0 &&
+	kochabCooieGameOnOboleUnweave === Math.PI
+		? averredBathersBoxroomBuggyNurl
+		: anodyneCondosMalateOverateRetinol)[AnnularCooeedSplicesWalksWayWay];
+
+bifornCringerMoshedPerplexSawder =
+	askTrovenaBeenaDependsRowans +
+	(glimseGlyphsHazardNoopsTieTie === 0
+		? averredBathersBoxroomBuggyNurl
+		: anodyneCondosMalateOverateRetinol
+	).Fooooooooooo.Fooooooooooo;
+
+bifornCringerMoshedPerplexSawder =
+	askTrovenaBeenaDependsRowans +
+	(glimseGlyphsHazardNoopsTieTie === 0 &&
+	kochabCooieGameOnOboleUnweave === Math.PI
+		? averredBathersBoxroomBuggyNurl
+		: anodyneCondosMalateOverateRetinol
+	).Fooooooooooo.Fooooooooooo;
+
+bifornCringerMoshedPerplexSawder =
+	askTrovenaBeenaDependsRowans +
+	(glimseGlyphsHazardNoopsTieTie === 0
+		? averredBathersBoxroomBuggyNurl
+		: anodyneCondosMalateOverateRetinol)(Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder =
+	askTrovenaBeenaDependsRowans +
+	(glimseGlyphsHazardNoopsTieTie === 0 &&
+		kochabCooieGameOnOboleUnweave === Math.PI
+		? averredBathersBoxroomBuggyNurl
+		: anodyneCondosMalateOverateRetinol)(Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder = (
+	glimseGlyphsHazardNoopsTieTie === 0 &&
+	kochabCooieGameOnOboleUnweave === Math.PI
+		? averredBathersBoxroomBuggyNurl
+		: anodyneCondosMalateOverateRetinol
+).annularCooeedSplicesWalksWayWay
+	.annularCooeedSplicesWalksWayWay(annularCooeedSplicesWalksWayWay)
+	.annularCooeedSplicesWalksWayWay();
+
+foo = (
+	coooooooooooooooooooooooooooooooooooooooooooooooooooond
+		? baaaaaaaaaaaaaaaaaaaaar
+		: baaaaaaaaaaaaaaaaaaaaaz
+)?.()?.()?.();
+
+foo = (
+	coooooooooooooooooooooooooooooooooooooooooooooooooooond
+		? baaaaaaaaaaaaaaaaaaaaar
+		: baaaaaaaaaaaaaaaaaaaaaz
+)()()();
+
+foo =
+	foo.bar.baz[
+		coooooooooooooooooooooooooooooooooooooooooooooooooooond
+			? baaaaaaaaaaaaaaaaaaaaar
+			: baaaaaaaaaaaaaaaaaaaaaz
+	];
+
+const decorated = (arg, ignoreRequestError) => {
+	return (
+		typeof arg === "string" ||
+		(arg && arg.valueOf && typeof arg.valueOf() === "string")
+			? $delegate(arg, ignoreRequestError)
+			: handleAsyncOperations(arg, ignoreRequestError)
+	).foo();
+};
+
+================================================================================
+`;
+
+exports[`indent-after-paren.js format 1`] = `
+====================================options=====================================
+parsers: ["babel", "flow", "typescript"]
+printWidth: 80
+                                                                                | printWidth
+=====================================input======================================
+foo7 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+
+foo8 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo9 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+
+function foo10() {
+  return (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+}
+
+function foo11() {
+  throw (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+}
+
+function foo12() {
+  void (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+}
+
+foo13 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz
+).Fooooooooooo.Fooooooooooo;
+
+foo14 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo15 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz
+).Fooooooooooo.Fooooooooooo;
+
+function foo16() {
+  return (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz
+  ).Fooooooooooo.Fooooooooooo;
+}
+
+function foo17() {
+  throw (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz
+  ).Fooooooooooo.Fooooooooooo;
+}
+
+function foo18() {
+  void (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz
+  ).Fooooooooooo.Fooooooooooo;
+}
+
+foo19 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+
+foo20 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo21 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+
+function foo22() {
+  return (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+}
+
+function foo23() {
+  throw (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+}
+
+function foo24() {
+  void (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+}
+
+foo25 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+
+foo26 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo27 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+
+function foo28() {
+  return (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+}
+
+function foo29() {
+  throw (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+}
+
+function foo30() {
+  void (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+}
+
+function* foo31() {
+  yield (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+  yield (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+      ? baaaaaaaaaaaaaaaaaaaaar
+      : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+  yield (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+      ? baaaaaaaaaaaaaaaaaaaaar
+      : baaaaaaaaaaaaaaaaaaaaaz).Fooooooooooo.Fooooooooooo;
+  yield (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo.Fooooooooooo];
+}
+
+const foo32 = new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+function foo33() {
+  return new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz
+  )(Fooooooooooo.Fooooooooooo);
+}
+
+function foo34() {
+  throw new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz
+  )(Fooooooooooo.Fooooooooooo);
+}
+
+function foo35() {
+  void new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz
+  )(Fooooooooooo.Fooooooooooo);
+}
+
+foo36 = new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder =
+  askTrovenaBeenaDependsRowans +
+  ((glimseGlyphsHazardNoopsTieTie === 0
+    ? averredBathersBoxroomBuggyNurl
+    : anodyneCondosMalateOverateRetinol)[AnnularCooeedSplicesWalksWayWay]);
+
+bifornCringerMoshedPerplexSawder =
+  askTrovenaBeenaDependsRowans +
+  ((glimseGlyphsHazardNoopsTieTie === 0 &&
+  kochabCooieGameOnOboleUnweave === Math.PI
+    ? averredBathersBoxroomBuggyNurl
+    : anodyneCondosMalateOverateRetinol)[AnnularCooeedSplicesWalksWayWay]);
+
+bifornCringerMoshedPerplexSawder =
+  askTrovenaBeenaDependsRowans +
+  ((glimseGlyphsHazardNoopsTieTie === 0
+    ? averredBathersBoxroomBuggyNurl
+    : anodyneCondosMalateOverateRetinol).Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder =
+  askTrovenaBeenaDependsRowans +
+  ((glimseGlyphsHazardNoopsTieTie === 0 &&
+  kochabCooieGameOnOboleUnweave === Math.PI
+    ? averredBathersBoxroomBuggyNurl
+    : anodyneCondosMalateOverateRetinol).Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder =
+    askTrovenaBeenaDependsRowans +
+    ((glimseGlyphsHazardNoopsTieTie === 0
+      ? averredBathersBoxroomBuggyNurl
+      : anodyneCondosMalateOverateRetinol)(Fooooooooooo.Fooooooooooo));
+
+bifornCringerMoshedPerplexSawder =
+    askTrovenaBeenaDependsRowans +
+    ((glimseGlyphsHazardNoopsTieTie === 0 &&
+    kochabCooieGameOnOboleUnweave === Math.PI
+      ? averredBathersBoxroomBuggyNurl
+      : anodyneCondosMalateOverateRetinol)(Fooooooooooo.Fooooooooooo));
+
+bifornCringerMoshedPerplexSawder = (
+  glimseGlyphsHazardNoopsTieTie === 0 &&
+  kochabCooieGameOnOboleUnweave === Math.PI
+    ? averredBathersBoxroomBuggyNurl
+    : anodyneCondosMalateOverateRetinol
+  ).annularCooeedSplicesWalksWayWay
+    .annularCooeedSplicesWalksWayWay(annularCooeedSplicesWalksWayWay)
+    .annularCooeedSplicesWalksWayWay();
+
+foo = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz)?.()?.()?.();
+
+foo = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz)()()();
+
+foo =
+  foo.bar.baz[
+    coooooooooooooooooooooooooooooooooooooooooooooooooooond
+      ? baaaaaaaaaaaaaaaaaaaaar
+      : baaaaaaaaaaaaaaaaaaaaaz
+  ];
+
+const decorated = (arg, ignoreRequestError) => {
+  return (
+    typeof arg === "string" ||
+    (arg && arg.valueOf && typeof arg.valueOf() === "string")
+      ? $delegate(arg, ignoreRequestError)
+      : handleAsyncOperations(arg, ignoreRequestError)
+  ).foo();
+};
+
+=====================================output=====================================
+foo7 = (
+  coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz
+)[Fooooooooooo];
+
+foo8 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo9 = (
+  coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz
+)[Fooooooooooo];
+
+function foo10() {
+  return (
+    coooooooooooooooooooooooooooooooooooooooooooooooooooond
+      ? baaaaaaaaaaaaaaaaaaaaar
+      : baaaaaaaaaaaaaaaaaaaaaz
+  )[Fooooooooooo];
+}
+
+function foo11() {
+  throw (
+    coooooooooooooooooooooooooooooooooooooooooooooooooooond
+      ? baaaaaaaaaaaaaaaaaaaaar
+      : baaaaaaaaaaaaaaaaaaaaaz
+  )[Fooooooooooo];
+}
+
+function foo12() {
+  void (
+    coooooooooooooooooooooooooooooooooooooooooooooooooooond
+      ? baaaaaaaaaaaaaaaaaaaaar
+      : baaaaaaaaaaaaaaaaaaaaaz
+  )[Fooooooooooo];
+}
+
+foo13 = (
+  coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz
+).Fooooooooooo.Fooooooooooo;
+
+foo14 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo15 = (
+  coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz
+).Fooooooooooo.Fooooooooooo;
+
+function foo16() {
+  return (
+    coooooooooooooooooooooooooooooooooooooooooooooooooooond
+      ? baaaaaaaaaaaaaaaaaaaaar
+      : baaaaaaaaaaaaaaaaaaaaaz
+  ).Fooooooooooo.Fooooooooooo;
+}
+
+function foo17() {
+  throw (
+    coooooooooooooooooooooooooooooooooooooooooooooooooooond
+      ? baaaaaaaaaaaaaaaaaaaaar
+      : baaaaaaaaaaaaaaaaaaaaaz
+  ).Fooooooooooo.Fooooooooooo;
+}
+
+function foo18() {
+  void (
+    coooooooooooooooooooooooooooooooooooooooooooooooooooond
+      ? baaaaaaaaaaaaaaaaaaaaar
+      : baaaaaaaaaaaaaaaaaaaaaz
+  ).Fooooooooooo.Fooooooooooo;
+}
+
+foo19 = (
+  coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+foo20 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo21 = (
+  coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+function foo22() {
+  return (
+    coooooooooooooooooooooooooooooooooooooooooooooooooooond
+      ? baaaaaaaaaaaaaaaaaaaaar
+      : baaaaaaaaaaaaaaaaaaaaaz
+  )(Fooooooooooo.Fooooooooooo);
+}
+
+function foo23() {
+  throw (
+    coooooooooooooooooooooooooooooooooooooooooooooooooooond
+      ? baaaaaaaaaaaaaaaaaaaaar
+      : baaaaaaaaaaaaaaaaaaaaaz
+  )(Fooooooooooo.Fooooooooooo);
+}
+
+function foo24() {
+  void (
+    coooooooooooooooooooooooooooooooooooooooooooooooooooond
+      ? baaaaaaaaaaaaaaaaaaaaar
+      : baaaaaaaaaaaaaaaaaaaaaz
+  )(Fooooooooooo.Fooooooooooo);
+}
+
+foo25 = (
+  coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz
+)?.(Fooooooooooo.Fooooooooooo);
+
+foo26 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo27 = (
+  coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz
+)?.(Fooooooooooo.Fooooooooooo);
+
+function foo28() {
+  return (
+    coooooooooooooooooooooooooooooooooooooooooooooooooooond
+      ? baaaaaaaaaaaaaaaaaaaaar
+      : baaaaaaaaaaaaaaaaaaaaaz
+  )?.(Fooooooooooo.Fooooooooooo);
+}
+
+function foo29() {
+  throw (
+    coooooooooooooooooooooooooooooooooooooooooooooooooooond
+      ? baaaaaaaaaaaaaaaaaaaaar
+      : baaaaaaaaaaaaaaaaaaaaaz
+  )?.(Fooooooooooo.Fooooooooooo);
+}
+
+function foo30() {
+  void (
+    coooooooooooooooooooooooooooooooooooooooooooooooooooond
+      ? baaaaaaaaaaaaaaaaaaaaar
+      : baaaaaaaaaaaaaaaaaaaaaz
+  )?.(Fooooooooooo.Fooooooooooo);
+}
+
+function* foo31() {
+  yield (
+    coooooooooooooooooooooooooooooooooooooooooooooooooooond
+      ? baaaaaaaaaaaaaaaaaaaaar
+      : baaaaaaaaaaaaaaaaaaaaaz
+  )?.(Fooooooooooo.Fooooooooooo);
+  yield (
+    coooooooooooooooooooooooooooooooooooooooooooooooooooond
+      ? baaaaaaaaaaaaaaaaaaaaar
+      : baaaaaaaaaaaaaaaaaaaaaz
+  )(Fooooooooooo.Fooooooooooo);
+  yield (
+    coooooooooooooooooooooooooooooooooooooooooooooooooooond
+      ? baaaaaaaaaaaaaaaaaaaaar
+      : baaaaaaaaaaaaaaaaaaaaaz
+  ).Fooooooooooo.Fooooooooooo;
+  yield (
+    coooooooooooooooooooooooooooooooooooooooooooooooooooond
+      ? baaaaaaaaaaaaaaaaaaaaar
+      : baaaaaaaaaaaaaaaaaaaaaz
+  )[Fooooooooooo.Fooooooooooo];
+}
+
+const foo32 = new (
+  coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+function foo33() {
+  return new (
+    coooooooooooooooooooooooooooooooooooooooooooooooooooond
+      ? baaaaaaaaaaaaaaaaaaaaar
+      : baaaaaaaaaaaaaaaaaaaaaz
+  )(Fooooooooooo.Fooooooooooo);
+}
+
+function foo34() {
+  throw new (
+    coooooooooooooooooooooooooooooooooooooooooooooooooooond
+      ? baaaaaaaaaaaaaaaaaaaaar
+      : baaaaaaaaaaaaaaaaaaaaaz
+  )(Fooooooooooo.Fooooooooooo);
+}
+
+function foo35() {
+  void new (
+    coooooooooooooooooooooooooooooooooooooooooooooooooooond
+      ? baaaaaaaaaaaaaaaaaaaaar
+      : baaaaaaaaaaaaaaaaaaaaaz
+  )(Fooooooooooo.Fooooooooooo);
+}
+
+foo36 = new (
+  coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder =
+  askTrovenaBeenaDependsRowans +
+  (glimseGlyphsHazardNoopsTieTie === 0
+    ? averredBathersBoxroomBuggyNurl
+    : anodyneCondosMalateOverateRetinol)[AnnularCooeedSplicesWalksWayWay];
+
+bifornCringerMoshedPerplexSawder =
+  askTrovenaBeenaDependsRowans +
+  (glimseGlyphsHazardNoopsTieTie === 0 &&
+  kochabCooieGameOnOboleUnweave === Math.PI
+    ? averredBathersBoxroomBuggyNurl
+    : anodyneCondosMalateOverateRetinol)[AnnularCooeedSplicesWalksWayWay];
+
+bifornCringerMoshedPerplexSawder =
+  askTrovenaBeenaDependsRowans +
+  (glimseGlyphsHazardNoopsTieTie === 0
+    ? averredBathersBoxroomBuggyNurl
+    : anodyneCondosMalateOverateRetinol
+  ).Fooooooooooo.Fooooooooooo;
+
+bifornCringerMoshedPerplexSawder =
+  askTrovenaBeenaDependsRowans +
+  (glimseGlyphsHazardNoopsTieTie === 0 &&
+  kochabCooieGameOnOboleUnweave === Math.PI
+    ? averredBathersBoxroomBuggyNurl
+    : anodyneCondosMalateOverateRetinol
+  ).Fooooooooooo.Fooooooooooo;
+
+bifornCringerMoshedPerplexSawder =
+  askTrovenaBeenaDependsRowans +
+  (glimseGlyphsHazardNoopsTieTie === 0
+    ? averredBathersBoxroomBuggyNurl
+    : anodyneCondosMalateOverateRetinol)(Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder =
+  askTrovenaBeenaDependsRowans +
+  (glimseGlyphsHazardNoopsTieTie === 0 &&
+    kochabCooieGameOnOboleUnweave === Math.PI
+    ? averredBathersBoxroomBuggyNurl
+    : anodyneCondosMalateOverateRetinol)(Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder = (
+  glimseGlyphsHazardNoopsTieTie === 0 &&
+  kochabCooieGameOnOboleUnweave === Math.PI
+    ? averredBathersBoxroomBuggyNurl
+    : anodyneCondosMalateOverateRetinol
+).annularCooeedSplicesWalksWayWay
+  .annularCooeedSplicesWalksWayWay(annularCooeedSplicesWalksWayWay)
+  .annularCooeedSplicesWalksWayWay();
+
+foo = (
+  coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz
+)?.()?.()?.();
+
+foo = (
+  coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz
+)()()();
+
+foo =
+  foo.bar.baz[
+    coooooooooooooooooooooooooooooooooooooooooooooooooooond
+      ? baaaaaaaaaaaaaaaaaaaaar
+      : baaaaaaaaaaaaaaaaaaaaaz
+  ];
+
+const decorated = (arg, ignoreRequestError) => {
+  return (
+    typeof arg === "string" ||
+    (arg && arg.valueOf && typeof arg.valueOf() === "string")
+      ? $delegate(arg, ignoreRequestError)
+      : handleAsyncOperations(arg, ignoreRequestError)
+  ).foo();
+};
+
+================================================================================
+`;
+
 exports[`nested.js - {"tabWidth":4} format 1`] = `
 ====================================options=====================================
 parsers: ["babel", "flow", "typescript"]
diff --git a/tests/js/ternaries/indent-after-paren.js b/tests/js/ternaries/indent-after-paren.js
new file mode 100644
index 000000000000..35ebca828293
--- /dev/null
+++ b/tests/js/ternaries/indent-after-paren.js
@@ -0,0 +1,234 @@
+foo7 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+
+foo8 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo9 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+
+function foo10() {
+  return (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+}
+
+function foo11() {
+  throw (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+}
+
+function foo12() {
+  void (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo];
+}
+
+foo13 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz
+).Fooooooooooo.Fooooooooooo;
+
+foo14 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo15 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz
+).Fooooooooooo.Fooooooooooo;
+
+function foo16() {
+  return (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz
+  ).Fooooooooooo.Fooooooooooo;
+}
+
+function foo17() {
+  throw (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz
+  ).Fooooooooooo.Fooooooooooo;
+}
+
+function foo18() {
+  void (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz
+  ).Fooooooooooo.Fooooooooooo;
+}
+
+foo19 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+
+foo20 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo21 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+
+function foo22() {
+  return (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+}
+
+function foo23() {
+  throw (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+}
+
+function foo24() {
+  void (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+}
+
+foo25 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+
+foo26 = (condition ? firstValue : secondValue)[SomeType];
+
+const foo27 = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+
+function foo28() {
+  return (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+}
+
+function foo29() {
+  throw (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+}
+
+function foo30() {
+  void (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+}
+
+function* foo31() {
+  yield (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)?.(Fooooooooooo.Fooooooooooo);
+  yield (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+      ? baaaaaaaaaaaaaaaaaaaaar
+      : baaaaaaaaaaaaaaaaaaaaaz)(Fooooooooooo.Fooooooooooo);
+  yield (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+      ? baaaaaaaaaaaaaaaaaaaaar
+      : baaaaaaaaaaaaaaaaaaaaaz).Fooooooooooo.Fooooooooooo;
+  yield (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz)[Fooooooooooo.Fooooooooooo];
+}
+
+const foo32 = new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+function foo33() {
+  return new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz
+  )(Fooooooooooo.Fooooooooooo);
+}
+
+function foo34() {
+  throw new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz
+  )(Fooooooooooo.Fooooooooooo);
+}
+
+function foo35() {
+  void new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz
+  )(Fooooooooooo.Fooooooooooo);
+}
+
+foo36 = new (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz
+)(Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder =
+  askTrovenaBeenaDependsRowans +
+  ((glimseGlyphsHazardNoopsTieTie === 0
+    ? averredBathersBoxroomBuggyNurl
+    : anodyneCondosMalateOverateRetinol)[AnnularCooeedSplicesWalksWayWay]);
+
+bifornCringerMoshedPerplexSawder =
+  askTrovenaBeenaDependsRowans +
+  ((glimseGlyphsHazardNoopsTieTie === 0 &&
+  kochabCooieGameOnOboleUnweave === Math.PI
+    ? averredBathersBoxroomBuggyNurl
+    : anodyneCondosMalateOverateRetinol)[AnnularCooeedSplicesWalksWayWay]);
+
+bifornCringerMoshedPerplexSawder =
+  askTrovenaBeenaDependsRowans +
+  ((glimseGlyphsHazardNoopsTieTie === 0
+    ? averredBathersBoxroomBuggyNurl
+    : anodyneCondosMalateOverateRetinol).Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder =
+  askTrovenaBeenaDependsRowans +
+  ((glimseGlyphsHazardNoopsTieTie === 0 &&
+  kochabCooieGameOnOboleUnweave === Math.PI
+    ? averredBathersBoxroomBuggyNurl
+    : anodyneCondosMalateOverateRetinol).Fooooooooooo.Fooooooooooo);
+
+bifornCringerMoshedPerplexSawder =
+    askTrovenaBeenaDependsRowans +
+    ((glimseGlyphsHazardNoopsTieTie === 0
+      ? averredBathersBoxroomBuggyNurl
+      : anodyneCondosMalateOverateRetinol)(Fooooooooooo.Fooooooooooo));
+
+bifornCringerMoshedPerplexSawder =
+    askTrovenaBeenaDependsRowans +
+    ((glimseGlyphsHazardNoopsTieTie === 0 &&
+    kochabCooieGameOnOboleUnweave === Math.PI
+      ? averredBathersBoxroomBuggyNurl
+      : anodyneCondosMalateOverateRetinol)(Fooooooooooo.Fooooooooooo));
+
+bifornCringerMoshedPerplexSawder = (
+  glimseGlyphsHazardNoopsTieTie === 0 &&
+  kochabCooieGameOnOboleUnweave === Math.PI
+    ? averredBathersBoxroomBuggyNurl
+    : anodyneCondosMalateOverateRetinol
+  ).annularCooeedSplicesWalksWayWay
+    .annularCooeedSplicesWalksWayWay(annularCooeedSplicesWalksWayWay)
+    .annularCooeedSplicesWalksWayWay();
+
+foo = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz)?.()?.()?.();
+
+foo = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz)()()();
+
+foo =
+  foo.bar.baz[
+    coooooooooooooooooooooooooooooooooooooooooooooooooooond
+      ? baaaaaaaaaaaaaaaaaaaaar
+      : baaaaaaaaaaaaaaaaaaaaaz
+  ];
+
+const decorated = (arg, ignoreRequestError) => {
+  return (
+    typeof arg === "string" ||
+    (arg && arg.valueOf && typeof arg.valueOf() === "string")
+      ? $delegate(arg, ignoreRequestError)
+      : handleAsyncOperations(arg, ignoreRequestError)
+  ).foo();
+};
diff --git a/tests/typescript/as/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/as/__snapshots__/jsfmt.spec.js.snap
index 9424724815bd..0c5e54eb895d 100644
--- a/tests/typescript/as/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/typescript/as/__snapshots__/jsfmt.spec.js.snap
@@ -333,3 +333,105 @@ function foo() {
 
 ================================================================================
 `;
+
+exports[`ternary.ts format 1`] = `
+====================================options=====================================
+parsers: ["typescript"]
+printWidth: 80
+                                                                                | printWidth
+=====================================input======================================
+foo = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz) as Fooooooooooo;
+
+foo = (condition ? firstValue : secondValue) as SomeType;
+
+const foo = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz) as Fooooooooooo;
+
+function foo() {
+  return (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz) as Fooooooooooo;
+}
+
+function foo() {
+  throw (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+      ? baaaaaaaaaaaaaaaaaaaaar
+      : baaaaaaaaaaaaaaaaaaaaaz) as Fooooooooooo;
+}
+
+function foo() {
+  void ((coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz) as Fooooooooooo);
+}
+
+bifornCringerMoshedPerplexSawder =
+  askTrovenaBeenaDependsRowans +
+  ((glimseGlyphsHazardNoopsTieTie === 0
+    ? averredBathersBoxroomBuggyNurl
+    : anodyneCondosMalateOverateRetinol) as AnnularCooeedSplicesWalksWayWay);
+
+bifornCringerMoshedPerplexSawder =
+  askTrovenaBeenaDependsRowans +
+  ((glimseGlyphsHazardNoopsTieTie === 0 &&
+  kochabCooieGameOnOboleUnweave === Math.PI
+    ? averredBathersBoxroomBuggyNurl
+    : anodyneCondosMalateOverateRetinol) as AnnularCooeedSplicesWalksWayWay);
+
+=====================================output=====================================
+foo = (
+  coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz
+) as Fooooooooooo;
+
+foo = (condition ? firstValue : secondValue) as SomeType;
+
+const foo = (
+  coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz
+) as Fooooooooooo;
+
+function foo() {
+  return (
+    coooooooooooooooooooooooooooooooooooooooooooooooooooond
+      ? baaaaaaaaaaaaaaaaaaaaar
+      : baaaaaaaaaaaaaaaaaaaaaz
+  ) as Fooooooooooo;
+}
+
+function foo() {
+  throw (
+    coooooooooooooooooooooooooooooooooooooooooooooooooooond
+      ? baaaaaaaaaaaaaaaaaaaaar
+      : baaaaaaaaaaaaaaaaaaaaaz
+  ) as Fooooooooooo;
+}
+
+function foo() {
+  void ((
+    coooooooooooooooooooooooooooooooooooooooooooooooooooond
+      ? baaaaaaaaaaaaaaaaaaaaar
+      : baaaaaaaaaaaaaaaaaaaaaz
+  ) as Fooooooooooo);
+}
+
+bifornCringerMoshedPerplexSawder =
+  askTrovenaBeenaDependsRowans +
+  ((glimseGlyphsHazardNoopsTieTie === 0
+    ? averredBathersBoxroomBuggyNurl
+    : anodyneCondosMalateOverateRetinol) as AnnularCooeedSplicesWalksWayWay);
+
+bifornCringerMoshedPerplexSawder =
+  askTrovenaBeenaDependsRowans +
+  ((glimseGlyphsHazardNoopsTieTie === 0 &&
+  kochabCooieGameOnOboleUnweave === Math.PI
+    ? averredBathersBoxroomBuggyNurl
+    : anodyneCondosMalateOverateRetinol) as AnnularCooeedSplicesWalksWayWay);
+
+================================================================================
+`;
diff --git a/tests/typescript/as/ternary.ts b/tests/typescript/as/ternary.ts
new file mode 100644
index 000000000000..723e464d6ed7
--- /dev/null
+++ b/tests/typescript/as/ternary.ts
@@ -0,0 +1,40 @@
+foo = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz) as Fooooooooooo;
+
+foo = (condition ? firstValue : secondValue) as SomeType;
+
+const foo = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz) as Fooooooooooo;
+
+function foo() {
+  return (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz) as Fooooooooooo;
+}
+
+function foo() {
+  throw (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+      ? baaaaaaaaaaaaaaaaaaaaar
+      : baaaaaaaaaaaaaaaaaaaaaz) as Fooooooooooo;
+}
+
+function foo() {
+  void ((coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz) as Fooooooooooo);
+}
+
+bifornCringerMoshedPerplexSawder =
+  askTrovenaBeenaDependsRowans +
+  ((glimseGlyphsHazardNoopsTieTie === 0
+    ? averredBathersBoxroomBuggyNurl
+    : anodyneCondosMalateOverateRetinol) as AnnularCooeedSplicesWalksWayWay);
+
+bifornCringerMoshedPerplexSawder =
+  askTrovenaBeenaDependsRowans +
+  ((glimseGlyphsHazardNoopsTieTie === 0 &&
+  kochabCooieGameOnOboleUnweave === Math.PI
+    ? averredBathersBoxroomBuggyNurl
+    : anodyneCondosMalateOverateRetinol) as AnnularCooeedSplicesWalksWayWay);
diff --git a/tests/typescript/ternaries/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/ternaries/__snapshots__/jsfmt.spec.js.snap
new file mode 100644
index 000000000000..4b758daa4b8e
--- /dev/null
+++ b/tests/typescript/ternaries/__snapshots__/jsfmt.spec.js.snap
@@ -0,0 +1,123 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`indent.ts format 1`] = `
+====================================options=====================================
+parsers: ["typescript"]
+printWidth: 80
+                                                                                | printWidth
+=====================================input======================================
+foo = (callNode.parent?.type === AST_NODE_TYPES.ChainExpression
+  ? callNode.parent.parent
+  : callNode.parent
+).TSESTree!.BinaryExpression;
+
+foo = (callNode.parent?.type === AST_NODE_TYPES.ChainExpression
+  ? callNode.parent.parent
+  : callNode.parent
+).TSESTree!.BinaryExpression;
+
+bifornCringerMoshedPerplexSawder = (glimseGlyphsHazardNoopsTieTie === 0 &&
+kochabCooieGameOnOboleUnweave === Math.PI
+  ? averredBathersBoxroomBuggyNurl
+  : anodyneCondosMalateOverateRetinol
+).annularCooeedSplicesWalksWayWay
+  .annularCooeedSplicesWalksWayWay(annularCooeedSplicesWalksWayWay)!
+  .annularCooeedSplicesWalksWayWay();
+
+foo = (callNode.parent?.type === AST_NODE_TYPES.ChainExpression
+  ? callNode.parent.parent
+  : callNode.parent
+).TSESTree!.BinaryExpression!;
+
+foo = (callNode.parent?.type === AST_NODE_TYPES.ChainExpression
+  ? callNode.parent.parent
+  : callNode.parent
+).TSESTree!.BinaryExpression!;
+
+bifornCringerMoshedPerplexSawder = (glimseGlyphsHazardNoopsTieTie === 0 &&
+kochabCooieGameOnOboleUnweave === Math.PI
+  ? averredBathersBoxroomBuggyNurl
+  : anodyneCondosMalateOverateRetinol
+).annularCooeedSplicesWalksWayWay
+  .annularCooeedSplicesWalksWayWay(annularCooeedSplicesWalksWayWay)!
+  .annularCooeedSplicesWalksWayWay()!;
+
+bifornCringerMoshedPerplexSawder =
+  askTrovenaBeenaDependsRowans +
+  (glimseGlyphsHazardNoopsTieTie === 0
+    ? averredBathersBoxroomBuggyNurl
+    : anodyneCondosMalateOverateRetinol
+  ).Foo!.foo;
+
+foo = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz)!;
+
+foo = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz)!!!!!;
+
+=====================================output=====================================
+foo = (
+  callNode.parent?.type === AST_NODE_TYPES.ChainExpression
+    ? callNode.parent.parent
+    : callNode.parent
+).TSESTree!.BinaryExpression;
+
+foo = (
+  callNode.parent?.type === AST_NODE_TYPES.ChainExpression
+    ? callNode.parent.parent
+    : callNode.parent
+).TSESTree!.BinaryExpression;
+
+bifornCringerMoshedPerplexSawder = (
+  glimseGlyphsHazardNoopsTieTie === 0 &&
+  kochabCooieGameOnOboleUnweave === Math.PI
+    ? averredBathersBoxroomBuggyNurl
+    : anodyneCondosMalateOverateRetinol
+).annularCooeedSplicesWalksWayWay
+  .annularCooeedSplicesWalksWayWay(annularCooeedSplicesWalksWayWay)!
+  .annularCooeedSplicesWalksWayWay();
+
+foo = (
+  callNode.parent?.type === AST_NODE_TYPES.ChainExpression
+    ? callNode.parent.parent
+    : callNode.parent
+).TSESTree!.BinaryExpression!;
+
+foo = (
+  callNode.parent?.type === AST_NODE_TYPES.ChainExpression
+    ? callNode.parent.parent
+    : callNode.parent
+).TSESTree!.BinaryExpression!;
+
+bifornCringerMoshedPerplexSawder = (
+  glimseGlyphsHazardNoopsTieTie === 0 &&
+  kochabCooieGameOnOboleUnweave === Math.PI
+    ? averredBathersBoxroomBuggyNurl
+    : anodyneCondosMalateOverateRetinol
+).annularCooeedSplicesWalksWayWay
+  .annularCooeedSplicesWalksWayWay(annularCooeedSplicesWalksWayWay)!
+  .annularCooeedSplicesWalksWayWay()!;
+
+bifornCringerMoshedPerplexSawder =
+  askTrovenaBeenaDependsRowans +
+  (glimseGlyphsHazardNoopsTieTie === 0
+    ? averredBathersBoxroomBuggyNurl
+    : anodyneCondosMalateOverateRetinol
+  ).Foo!.foo;
+
+foo = (
+  coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz
+)!;
+
+foo = (
+  coooooooooooooooooooooooooooooooooooooooooooooooooooond
+    ? baaaaaaaaaaaaaaaaaaaaar
+    : baaaaaaaaaaaaaaaaaaaaaz
+)!!!!!;
+
+================================================================================
+`;
diff --git a/tests/typescript/ternaries/indent.ts b/tests/typescript/ternaries/indent.ts
new file mode 100644
index 000000000000..07e11147fb25
--- /dev/null
+++ b/tests/typescript/ternaries/indent.ts
@@ -0,0 +1,50 @@
+foo = (callNode.parent?.type === AST_NODE_TYPES.ChainExpression
+  ? callNode.parent.parent
+  : callNode.parent
+).TSESTree!.BinaryExpression;
+
+foo = (callNode.parent?.type === AST_NODE_TYPES.ChainExpression
+  ? callNode.parent.parent
+  : callNode.parent
+).TSESTree!.BinaryExpression;
+
+bifornCringerMoshedPerplexSawder = (glimseGlyphsHazardNoopsTieTie === 0 &&
+kochabCooieGameOnOboleUnweave === Math.PI
+  ? averredBathersBoxroomBuggyNurl
+  : anodyneCondosMalateOverateRetinol
+).annularCooeedSplicesWalksWayWay
+  .annularCooeedSplicesWalksWayWay(annularCooeedSplicesWalksWayWay)!
+  .annularCooeedSplicesWalksWayWay();
+
+foo = (callNode.parent?.type === AST_NODE_TYPES.ChainExpression
+  ? callNode.parent.parent
+  : callNode.parent
+).TSESTree!.BinaryExpression!;
+
+foo = (callNode.parent?.type === AST_NODE_TYPES.ChainExpression
+  ? callNode.parent.parent
+  : callNode.parent
+).TSESTree!.BinaryExpression!;
+
+bifornCringerMoshedPerplexSawder = (glimseGlyphsHazardNoopsTieTie === 0 &&
+kochabCooieGameOnOboleUnweave === Math.PI
+  ? averredBathersBoxroomBuggyNurl
+  : anodyneCondosMalateOverateRetinol
+).annularCooeedSplicesWalksWayWay
+  .annularCooeedSplicesWalksWayWay(annularCooeedSplicesWalksWayWay)!
+  .annularCooeedSplicesWalksWayWay()!;
+
+bifornCringerMoshedPerplexSawder =
+  askTrovenaBeenaDependsRowans +
+  (glimseGlyphsHazardNoopsTieTie === 0
+    ? averredBathersBoxroomBuggyNurl
+    : anodyneCondosMalateOverateRetinol
+  ).Foo!.foo;
+
+foo = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz)!;
+
+foo = (coooooooooooooooooooooooooooooooooooooooooooooooooooond
+  ? baaaaaaaaaaaaaaaaaaaaar
+  : baaaaaaaaaaaaaaaaaaaaaz)!!!!!;
diff --git a/tests/typescript/ternaries/jsfmt.spec.js b/tests/typescript/ternaries/jsfmt.spec.js
new file mode 100644
index 000000000000..2ea3bb6eb2e4
--- /dev/null
+++ b/tests/typescript/ternaries/jsfmt.spec.js
@@ -0,0 +1,1 @@
+run_spec(__dirname, ["typescript"]);