function printTernaryOld(path, options, print) {
  const { node } = path;
  const isConditionalExpression = node.type === "ConditionalExpression";
  const consequentNodePropertyName = isConditionalExpression
    ? "consequent"
    : "trueType";
  const alternateNodePropertyName = isConditionalExpression
    ? "alternate"
    : "falseType";
  const testNodePropertyNames = isConditionalExpression
    ? ["test"]
    : ["checkType", "extendsType"];
  const consequentNode = node[consequentNodePropertyName];
  const alternateNode = node[alternateNodePropertyName];
  const parts = [];

  // We print a ConditionalExpression in either "JSX mode" or "normal mode".
  // See `tests/format/jsx/conditional-expression.js` for more info.
  let jsxMode = false;
  const { parent } = path;
  const isParentTest =
    parent.type === node.type &&
    testNodePropertyNames.some((prop) => parent[prop] === node);
  let forceNoIndent = parent.type === node.type && !isParentTest;

  // Find the outermost non-ConditionalExpression parent, and the outermost
  // ConditionalExpression parent. We'll use these to determine if we should
  // print in JSX mode.
  let currentParent;
  let previousParent;
  let i = 0;
  do {
    previousParent = currentParent || node;
    currentParent = path.getParentNode(i);
    i++;
  } while (
    currentParent &&
    currentParent.type === node.type &&
    testNodePropertyNames.every(
      (prop) => currentParent[prop] !== previousParent,
    )
  );
  const firstNonConditionalParent = currentParent || parent;
  const lastConditionalParent = previousParent;

  if (
    isConditionalExpression &&
    (isJsxElement(node[testNodePropertyNames[0]]) ||
      isJsxElement(consequentNode) ||
      isJsxElement(alternateNode) ||
      conditionalExpressionChainContainsJsx(lastConditionalParent))
  ) {
    jsxMode = true;
    forceNoIndent = true;

    // Even though they don't need parens, we wrap (almost) everything in
    // parens when using ?: within JSX, because the parens are analogous to
    // curly braces in an if statement.
    const wrap = (doc) => [
      ifBreak("("),
      indent([softline, doc]),
      softline,
      ifBreak(")"),
    ];

    // The only things we don't wrap are:
    // * Nested conditional expressions in alternates
    // * null
    // * undefined
    const isNil = (node) =>
      node.type === "NullLiteral" ||
      (node.type === "Literal" && node.value === null) ||
      (node.type === "Identifier" && node.name === "undefined");

    parts.push(
      " ? ",
      isNil(consequentNode)
        ? print(consequentNodePropertyName)
        : wrap(print(consequentNodePropertyName)),
      " : ",
      alternateNode.type === node.type || isNil(alternateNode)
        ? print(alternateNodePropertyName)
        : wrap(print(alternateNodePropertyName)),
    );
  } else {
    /*
    This does not mean to indent, but make the doc aligned with the first character after `? ` or `: `,
    so we use `2` instead of `options.tabWidth` here.

    ```js
    test
     ? {
         consequent
       }
     : alternate
    ```

    instead of

    ```js
    test
     ? {
       consequent
     }
     : alternate
    ```
    */
    const printBranch = (nodePropertyName) =>
      options.useTabs
        ? indent(print(nodePropertyName))
        : align(2, print(nodePropertyName));
    // normal mode
    const part = [
      line,
      "? ",
      consequentNode.type === node.type ? ifBreak("", "(") : "",
      printBranch(consequentNodePropertyName),
      consequentNode.type === node.type ? ifBreak("", ")") : "",
      line,
      ": ",
      printBranch(alternateNodePropertyName),
    ];
    parts.push(
      parent.type !== node.type ||
        parent[alternateNodePropertyName] === node ||
        isParentTest
        ? part
        : options.useTabs
          ? dedent(indent(part))
          : align(Math.max(0, options.tabWidth - 2), part),
    );
  }

  // We want a whole chain of ConditionalExpressions to all
  // break if any of them break. That means we should only group around the
  // outer-most ConditionalExpression.
  const shouldBreak = [
    consequentNodePropertyName,
    alternateNodePropertyName,
    ...testNodePropertyNames,
  ].some((property) =>
    hasComment(
      node[property],
      (comment) =>
        isBlockComment(comment) &&
        hasNewlineInRange(
          options.originalText,
          locStart(comment),
          locEnd(comment),
        ),
    ),
  );
  const maybeGroup = (doc) =>
    parent === firstNonConditionalParent
      ? group(doc, { shouldBreak })
      : shouldBreak
        ? [doc, breakParent]
        : doc;

  // Break the closing paren to keep the chain right after it:
  // (a
  //   ? b
  //   : c
  // ).call()
  const breakClosingParen =
    !jsxMode &&
    (isMemberExpression(parent) ||
      (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 && !shouldExtraIndent
      ? softline
      : "",
  ]);

  return isParentTest || shouldExtraIndent
    ? group([indent([softline, result]), softline])
    : result;
}
The following is the shared logic for
ternary operators, namely ConditionalExpression,
ConditionalTypeAnnotation and TSConditionalType
@param {AstPath} path - The path to the ConditionalExpression/TSConditionalType node.
@param {Options} options - Prettier options
@param {Function} print - Print function to call recursively
@returns {Doc}