Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug(virtual-scroll): Type inference broken when using *ngFor nested inside *cdkVirtualFor with keyvalue pipe #27283

Closed
1 task
benelliott opened this issue Jun 12, 2023 · 2 comments
Labels
needs triage This issue needs to be triaged by the team

Comments

@benelliott
Copy link
Contributor

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

Note: StackBlitz template is outdated, points to v15.x, but this is present in 16.0.4 also.

If you iterate over a key-value collection using *ngFor inside a *cdkVirtualFor, you encounter a compile error.

This error does not occur if you use *ngFor nested inside *ngFor.

Reproduction

StackBlitz link: https://stackblitz.com/edit/components-issue-kfvxis?file=src%2Fapp%2Fexample-component.html
Steps to reproduce:

  1. Open demo
  2. Observe no compile error under *ngFor
  3. Uncomment *cdkVirtualFor example
  4. Observe compile error

Expected Behavior

CdkVirtualFor should be a drop-in replacement for NgFor.

Actual Behavior

Object is of type 'unknown'. error.

Environment

  • Angular: 16.0.5
  • CDK/Material: 16.0.4
  • Browser(s): All
  • Operating System (e.g. Windows, macOS, Ubuntu): All
@benelliott benelliott added the needs triage This issue needs to be triaged by the team label Jun 12, 2023
@crisbeto
Copy link
Member

I suspect this is the same root cause as #26609 where we don't have proper typings for the virtual for context yet.

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jul 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs triage This issue needs to be triaged by the team
Projects
None yet
Development

No branches or pull requests

2 participants