IssueRaiser

Prettier removes parentheses around conditional in ternary expression

**Prettier 1.10.2** [Playground link](https://prettier.io/playground/#N4Igxg9gdgLgprEAuc0DOMAEAzArlMTAXkwAoA3AQwBsBBAGkyuoCEBKJTAIwgmrkpRiAPkzAAOkMwAnODFzShFGrUwAyNUxrtJmPZgD8mGNNxxd+zthpo4AbkkBfEPRAQADjACW6ZKErS0hAA7gAKAQhoyCCU5BBeACYuMRjI1tS2rlzSlGAA1nIAyu65XlAA5sgmZq4JEGBpNnCuZbbSMKE55QC2lI0ZzSAAVmgAHiw5+UWU3XAAMmVw-ZluuDDuawBMy4Ml0m3RMACe7nBoYNJensnul7AA6okwABbIABwADK63ELb3Oe5orcznBpOQlq5ZABHXBeWSdSg9PpIdIrWzdLxVUyDNBlcr8ACKuAg8B2rhglC4jwSL2Qm3JOS81DxAGEIN1etEoNAISBcLYACqUqIopqORxAA) ```sh --parser typescript ``` **Input:** ```tsx const func = (valA, valB): boolean => { return (valA && valB) ? true : false; } ``` **Output:** ```tsx const func = (valA, valB): boolean => { return valA && valB ? true : false; }; ``` **Expected behavior:** Retain parentheses around conditional

Posted by theseyi on Jan 24, 2018, 2:06 AM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.4,500 issues0 comments

github (Other)

Prettier removes parentheses around conditional in ternary expression

theseyiJan 24, 2018, 2:06 AM

**Prettier 1.10.2** [Playground link](https://prettier.io/playground/#N4Igxg9gdgLgprEAuc0DOMAEAzArlMTAXkwAoA3AQwBsBBAGkyuoCEBKJTAIwgmrkpRiAPkzAAOkMwAnODFzShFGrUwAyNUxrtJmPZgD8mGNNxxd+zthpo4AbkkBfEPRAQADjACW6ZKErS0hAA7gAKAQhoyCCU5BBeACYuMRjI1tS2rlzSlGAA1nIAyu65XlAA5sgmZq4JEGBpNnCuZbbSMKE55QC2lI0ZzSAAVmgAHiw5+UWU3XAAMmVw-ZluuDDuawBMy4Ml0m3RMACe7nBoYNJensnul7AA6okwABbIABwADK63ELb3Oe5orcznBpOQlq5ZABHXBeWSdSg9PpIdIrWzdLxVUyDNBlcr8ACKuAg8B2rhglC4jwSL2Qm3JOS81DxAGEIN1etEoNAISBcLYACqUqIopqORxAA) ```sh --parser typescript ``` **Input:** ```tsx const func = (valA, valB): boolean => { return (valA && valB) ? true : false; } ``` **Output:** ```tsx const func = (valA, valB): boolean => { return valA && valB ? true : false; }; ``` **Expected behavior:** Retain parentheses around conditional

Comments (0)

No comments yet. Start the discussion.

Comment on this issue