diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index f1410df6421..6cc1eb0bea9 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -118,7 +118,7 @@ Argument LANGUAGE is either `typescript' or `tsx'." ((and (parent-is "comment") c-ts-common-looking-at-star) c-ts-common-comment-start-after-first-star -1) ((parent-is "comment") prev-adaptive-prefix 0) - ((parent-is "ternary_expression") parent-bol typescript-ts-mode-indent-offset) + ((parent-is "ternary_expression") standalone-parent typescript-ts-mode-indent-offset) ((parent-is "member_expression") parent-bol typescript-ts-mode-indent-offset) ((parent-is "named_imports") parent-bol typescript-ts-mode-indent-offset) ((parent-is "statement_block") parent-bol typescript-ts-mode-indent-offset) diff --git a/test/lisp/progmodes/typescript-ts-mode-resources/indent.erts b/test/lisp/progmodes/typescript-ts-mode-resources/indent.erts index ef7368602d6..8abaa81c627 100644 --- a/test/lisp/progmodes/typescript-ts-mode-resources/indent.erts +++ b/test/lisp/progmodes/typescript-ts-mode-resources/indent.erts @@ -93,6 +93,15 @@ const foo = () => { }; =-=-= +Name: Chained ternary expressions + +=-= +const a = cond1 ? 1 + : cond2 ? 2 + : cond3 ? 3 + : 4; +=-=-= + Code: (lambda () (setq indent-tabs-mode nil)