Skip to content

@for with async - Object is possible null #51993

@alexander-kastil

Description

@alexander-kastil

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

compiler

Is this a regression?

Yes

Description

I tried using the new control flow with the async pipe and got the err that the Object is possible 'null'. Voucher$ is a simple array in combination with of(arr)

    @for (v of vouchers$ | async; track v) {
      <tr>
        <td>{{ v.ID }}</td>          
      </tr>
    }

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

[ERROR] NG1: Object is possibly 'null'. [plugin angular-compiler]

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

_                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 17.0.0-next.6
Node: 18.17.1
Package Manager: npm 9.6.7
OS: win32 x64

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

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1700.0-next.6
@angular-devkit/build-angular   17.0.0-next.6
@angular-devkit/core            17.0.0-next.6
@angular-devkit/schematics      17.0.0-next.6
@angular/cdk                    17.0.0-next.5
@angular/fire                   7.6.1
@angular/material               17.0.0-next.5
@schematics/angular             17.0.0-next.6
rxjs                            7.8.1
typescript                      5.2.2
zone.js                         0.14.0

Anything else?

No response

Metadata

Metadata

Assignees

Labels

area: coreIssues related to the framework runtimebugcore: control flowIssues related to the built-in control flow (@if, @for, @switch)state: has PR

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions