angularrxjs

Angular 20 claims async pipe result to be unknown despite it being properly typed


I recently tried upgrading my project from Angular 19 to Angular 20. Now Angular throws the following error for all my async pipes:

Type 'unknown' must have a '[Symbol.iterator]()' method that returns an iterator

or

TS2339: Property 'id' does not exist on type 'unknown'

However, I don't get why it claims the type as unknown, as all my Observables are properly typed. Here's an example:

@if (invitation$ | async; as invitation) {

And invitation being declared as

invitation$: Observable<InvitationDto>;

inside the controller. Trying to access it, I get the error:

[value]="getUrl(invitation.id)"

Solution

  • Upgrading rxjs from 7.4.x to 7.8.x solved the issue for me.