Thanks to visit codestin.com
Credit goes to github.com

Skip to content

@let pollutes component scope #58242

Closed as not planned
Closed as not planned
@austinw-fineart

Description

@austinw-fineart

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

compiler

Is this a regression?

No

Description

Given the component:

@Component({
  selector: 'app-root',
  standalone: true,
  template: `
    @let i = 0;
    {{ this.i }}
  `,
})
export class App {
  protected i = 1;
}

What I expected: 1
What I got instead: 0
Given the warning below, it seems even the compiler is confused.

Please provide a link to a minimal reproduction of the bug

https://stackblitz.com/edit/stackblitz-starters-pesdcd?file=src%2Fmain.ts

Please provide the exception or error you saw

▲ [WARNING] NG8112: @let i is declared but its value is never read. [plugin angular-compiler]

src/main.ts:8:4:
  8 │     @let i = 0;
    ╵     ~~~~~~~~~~

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

Angular CLI: 18.2.7
Node: 18.20.3
Package Manager: npm 10.2.3
OS: linux x64

Angular: 18.2.7
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, router

Package Version

@angular-devkit/architect 0.1802.7
@angular-devkit/build-angular 18.2.7
@angular-devkit/core 18.2.7
@angular-devkit/schematics 18.2.7
@schematics/angular 18.2.7
rxjs 7.8.1
typescript 5.5.4
zone.js 0.14.10

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions