-
Notifications
You must be signed in to change notification settings - Fork 27k
Closed
Labels
area: compilerIssues related to `ngc`, Angular's template compilerIssues related to `ngc`, Angular's template compilerstate: has PR
Milestone
Description
Which @angular/* package(s) are the source of the bug?
compiler-cli
Is this a regression?
No
Description
The compiler does allow to use a @let variable inside a block, even if it declared after the block.
For example, this work:
@if (true) {
<h1>Hello from {{ aliasName }}!</h1>
}
@let aliasName = name; But it should throw if the variable is used inside the condition of the block:
@if (aliasName) {
<h1>Hello from {{ aliasName }}!</h1>
}
@let aliasName = name; It currently doesn't throw the NG8016 error, whereas it should as this code doesn't work.
Please provide a link to a minimal reproduction of the bug
Please provide the exception or error you saw
No response
Please provide the environment you discovered this bug in (run ng version)
ngular CLI: 18.1.0-rc.1
Node: 18.20.3
Package Manager: npm 10.2.3
OS: linux x64
Angular: 18.1.0-rc.0
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1801.0-rc.1
@angular-devkit/build-angular 18.1.0-rc.1
@angular-devkit/core 18.1.0-rc.1
@angular-devkit/schematics 18.1.0-rc.1
@angular/cli 18.1.0-rc.1
@schematics/angular 18.1.0-rc.1
rxjs 7.8.1
typescript 5.4.5
zone.js 0.14.7
Anything else?
No response
ilirbeqirii
Metadata
Metadata
Assignees
Labels
area: compilerIssues related to `ngc`, Angular's template compilerIssues related to `ngc`, Angular's template compilerstate: has PR