Skip to content

Ivy: fullTemplateTypeCheck errors with NgIterable #33527

Closed

Description

@cexbrayat

🐞 bug report

Affected Package

The issue is caused by package @angular/compiler

Is this a regression?

This is introduced by Ivy.

Description

A component with a template looking like:

<div *ngFor="let user of users | slice: 0:2 as total">
  {{ total.length }}: {{ user.name }}
</div>

ng build --prod with fullTemplateTypeCheck: true throws, as it thinks length is not a property of total.

🔬 Minimal Reproduction

https://github.com/cexbrayat/ng-iterable

🔥 Exception or Error


ERROR in src/app/app.component.html:2:6 - error TS2339: Property 'length' does not exist on type 'NgIterable'.
  Property 'length' does not exist on type 'Iterable'.

2   {{ total.length }}: {{ user.name }}
       ~~~~~~~~~~~~~

  src/app/app.component.ts:5:16
    5   templateUrl: './app.component.html',
                     ~~~~~~~~~~~~~~~~~~~~~~
    Error occurs in the template of component AppComponent.

🌍 Your Environment

Angular Version:


Angular CLI: 9.0.0-rc.0
Node: 12.12.0
OS: darwin x64
Angular: 9.0.0-rc.0
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.900.0-rc.0
@angular-devkit/build-angular     0.900.0-rc.0
@angular-devkit/build-optimizer   0.900.0-rc.0
@angular-devkit/build-webpack     0.900.0-rc.0
@angular-devkit/core              9.0.0-rc.0
@angular-devkit/schematics        9.0.0-rc.0
@ngtools/webpack                  9.0.0-rc.0
@schematics/angular               9.0.0-rc.0
@schematics/update                0.900.0-rc.0
rxjs                              6.5.3
typescript                        3.6.4
webpack                           4.41.2

Anything else relevant?

This is using ng and CLI 9.0.0-rc.0 and fTTC, but not using strictTemplates.

Activity

  1. added
    area: compiler
    on Nov 1, 2019
  2. added this to the needsTriage milestone on Nov 1, 2019
  3. added a commit that references this issue on Nov 20, 2019
    595375f
  4. cexbrayat commented on Nov 21, 2019

    @cexbrayat
    MemberAuthor

    @alxhub I'm still encoutering the issue using rc.3 now with strictTemplates: true.
    I updated the repro https://github.com/cexbrayat/ng-iterable

  5. JoostK commented on Dec 3, 2019

    @JoostK
    Member

    Closing as fixed in #33997.

  6. angular-automatic-lock-bot commented on Jan 3, 2020

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  7. locked and limited conversation to collaborators on Jan 3, 2020
  8. added
    regression
    and removed on Feb 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: compilerregressionstate: has PR

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions