You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Better error message for nullish coalescing a pipe argument #44871
In this case the developer probably intended for the birthday to be formatted like "YYYY-MM-dd", and if that format returned null or undefined for some reason (such as birthday being null or undefined), then it should fall back to "Unknown". However in practice, the ?? has higher precedence than the |, so it actually does 'YYYY-MM-dd' ?? 'Unknown', which is useless.
<!-- How the developer wanted it to work. --><span>{{ (birthday | date: 'YYYY-MM-dd') ?? 'Unknown' }}</span><!-- How it actually works. --><span>{{ birthday | date: ('YYYY-MM-dd' ?? 'Unknown') }}</span>
This mistake should be highlighted to users to bring awareness about the issue and how to properly parenthesize the expression to do what they want.
Alternatively we could just leave the existing diagnostic as is and accept a less-accurate error message. It does correctly identify the mistake, just with a less-than-ideal error message.
Reacted by Ertunga Bezirgan, Oto Dočkal, Totati, Front-end developer, Ertunga, Enea Jahollari, Alan Agius, Maurits Lourens, Inane Mohammed, Samuel Fernández and 8 more
This feature request is now candidate for our backlog! In the next phase, the community has 60 days to upvote. If the request receives more than 20 upvotes, we'll move it to our consideration list.
You can find more details about the feature request process in our documentation.
Thank you for submitting your feature request! Looks like during the polling process it didn't collect a sufficient number of votes to move to the next stage.
We want to keep Angular rich and ergonomic and at the same time be mindful about its scope and learning journey. If you think your request could live outside Angular's scope, we'd encourage you to collaborate with the community on publishing it as an open source package.
You can find more details about the feature request process in our documentation.
Closing as won't fix for the time-being / insufficient votes. As mentioned, the existing diagnostic does warn about the mistake and does have the correct error. It's just less descriptive than it could be. The template AST does not maintain a reference to parent nodes so modifying the existing diagnostic to have more contextual knowledge would be difficult/impossible.
Activity
angular-robot commentedon Jan 28, 2022
This feature request is now candidate for our backlog! In the next phase, the community has 60 days to upvote. If the request receives more than 20 upvotes, we'll move it to our consideration list.
You can find more details about the feature request process in our documentation.
angular-robot commentedon Mar 8, 2022
Just a heads up that we kicked off a community voting process for your feature request. There are 20 days until the voting process ends.
Find more details about Angular's feature request process in our documentation.
angular-robot commentedon Mar 28, 2022
Thank you for submitting your feature request! Looks like during the polling process it didn't collect a sufficient number of votes to move to the next stage.
We want to keep Angular rich and ergonomic and at the same time be mindful about its scope and learning journey. If you think your request could live outside Angular's scope, we'd encourage you to collaborate with the community on publishing it as an open source package.
You can find more details about the feature request process in our documentation.
atscott commentedon Jun 16, 2022
Closing as won't fix for the time-being / insufficient votes. As mentioned, the existing diagnostic does warn about the mistake and does have the correct error. It's just less descriptive than it could be. The template AST does not maintain a reference to parent nodes so modifying the existing diagnostic to have more contextual knowledge would be difficult/impossible.
angular-automatic-lock-bot commentedon Jul 17, 2022
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.