Skip to content

@let Bug -- should give precedence to a local let declaration over one from a parent view #56737

Description

@keatkeat87

Which @angular/* package(s) are the source of the bug?

compiler

Is this a regression?

Yes

Description

@let value = 'one';

@if (true) {
  @let value = 1;
  {{ value }}
}

result:
image
should be 1, not one.

app.component.js

image

another problem

@let value = 'hello world';
<input #value (input)="0">
{{ value.value }}

will get a error

image
looks like the value is not input ref, change the code to

@let value = 'hello world';
<input #value (input)="0">
{{ value }}

no more error, but the result is

image
it is a input ref...

image

Please provide a link to a minimal reproduction of the bug

https://github.com/keatkeat87/ng-let-bug.git

Please provide the exception or error you saw

No response

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 18.1.0-rc.0
Node: 20.11.1
Package Manager: yarn 1.22.19
OS: win32 x64

Angular: 18.1.0-next.4
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1801.0-rc.0
@angular-devkit/build-angular   18.1.0-rc.0
@angular-devkit/core            18.1.0-rc.0
@angular-devkit/schematics      18.1.0-rc.0
@angular/cli                    18.1.0-rc.0
@schematics/angular             18.1.0-rc.0
rxjs                            7.8.1
typescript                      5.5.2
zone.js                         0.14.7

Anything else?

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions