Skip to content

Compilation error when using *ngFor to iterate over unions of arrays of arrays of string literals #49310

@zilia-gmethot

Description

@zilia-gmethot

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

core

Is this a regression?

No

Description

Using the *ngFor directive, It is impossible to iterate over a variable of type union of arrays of arrays of string literals without obtaining a compilation error, even though it is valid TypeScript.

Please provide a link to a minimal reproduction of the bug

https://stackblitz.com/edit/angular-7hhamp?file=src/main.ts

Please provide the exception or error you saw

Error in src/main.ts (16:36)
Type 'FooBar' is not assignable to type 'NgIterable<Foo[]>'.

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

Angular CLI: 12.2.18
Node: 16.19.0 (Unsupported)
Package Manager: npm 8.19.3
OS: linux x64

Angular: 12.2.17
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1202.18
@angular-devkit/build-angular   12.2.18
@angular-devkit/core            12.2.18
@angular-devkit/schematics      12.2.18
@angular/cdk                    12.2.13
@angular/cli                    12.2.18
@angular/material               12.2.13
@schematics/angular             12.2.18
rxjs                            6.6.7
typescript

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: coreIssues related to the framework runtime

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions