-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(compiler): narrow the type of the aliased if block expression (#5…
…1952) Currently the TCB for aliased `if` blocks looks something like this: ``` // Markup: `@if (expr; as alias) { {{alias}} } if (block.condition) { var alias = block.condition; "" + alias; } ``` The problem with this approach is that the type of `alias` won't be narrowed. This is something that `NgIf` currently supports. These changes resolve the issue by emitting the variable outside the `if` block and using the variable reference instead: ``` // Markup: `@if (expr; as alias) { {{alias}} } var alias = block.condition; if (alias) { "" + alias; } ``` PR Close #51952
- Loading branch information
Showing
3 changed files
with
73 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters