-
Notifications
You must be signed in to change notification settings - Fork 27k
Description
🐞 bug report
Affected Package
The issue is caused by package @angular/coreIs this a regression?
Yes, the previous version in which this bug was not present was: 1.xDescription
AngularJS: a ? b : c | x means (a ? b : c) | x.
Angular: a ? b : c | x means a ? b : (c | x).
It is unexpected. E.g. see #19657, prettier/prettier#5586.
Who would write a ? b : c | x meaning a ? b : (c | x) given that a ? b | x : c even is not a valid expression? This does not look like an intentional design decision, more like a mistake (bug).
The natural expectation is that the pipe in the end of an expression should be applied to the whole expression, even if there is no parentheses. According to the docs, pipes are a way to write display-value transformations that you can declare in your HTML. They are perceived as external to expressions, something that modifies the expression without really being part of it. For this intuition to be valid, pipes must have the lowest precedence. The current behavior breaks the intuition for no reason, without adding any value.