Support for the new Angular @let syntax
Author: Tortila90Created Oct 3, 2024Updated Sep 29, 2026
Labelslanguage: htmltype: enhancementlanguage: templating
Description
Angular 18.1 introduced the new @let syntax: https://angular.dev/api/core/@let
It differs from the recently added @if or @for, because it doesn't contain any following brackets or parentheses.
As of now any code in a file that comes after @let may not be formatted correctly, especially if there are more @if or @for.
Input
With this new feature, when I give like this input:
@let foo = 'bar';
<div>
@if (foo) {
{{ foo }}
}
</div>Expected Output
I'd like to see this output:
@let foo = 'bar';
<div>
@if (foo) {
{{ foo }}
}
</div>Source: beautifier/js-beautify