'How to fix AngularFire migration observable error type?

I upgraded a project that I haven't touched in more than a year. It was at angular 10. I upgraded to angular 12 but now I need to upgrade AngularFire from v6 to v7 and it seems i have a typing problem (at first sight).

here are my dependencies :

"@angular/animations": "~12.2.16",
"@angular/cdk": "^12.2.13",
"@angular/common": "~12.2.16",
"@angular/compiler": "~12.2.16",
"@angular/core": "~12.2.16",
"@angular/fire": "^7.2.1",
"@angular/flex-layout": "^12.0.0-beta.35",
"@angular/forms": "~12.2.16",
"@angular/material": "^12.2.13",
"@angular/platform-browser": "~12.2.16",
"@angular/platform-browser-dynamic": "~12.2.16",
"@angular/router": "~12.2.16",
"date-fns": "^2.22.1",
"eslint": "^8.10.0",
"firebase": "^9.4.0",
"ngx-material-timepicker": "^5.5.3",
"rxjs": "^6.6.6",
"tslib": "^2.1.0",
"tslint": "^6.1.3",
"zone.js": "~0.11.4",
"rxfire": "^6.0.0"

I have a pretty simple non working example :

import { AngularFirestore, AngularFirestoreCollection } from '@angular/fire/compat/firestore';
import { Order } from '@models/order';
import {  Observable } from 'rxjs';

@Injectable({
  providedIn: 'root',
})
export class OrderService {
  private ordersCollection: AngularFirestoreCollection<Order>;
  orders: Observable<Order[]>;

  constructor(private firestore: AngularFirestore) {
    this.ordersCollection = firestore.collection<Order>('orders');
    this.orders = this.ordersCollection.valueChanges();
  }

 ...Some CRUD methods bu im not even there for the migration...
}

On the variable this.orders I have the following error :

Type 'Observable<Order[]>' is missing the following properties from type 'Observable<Order[]>': _isScalar, _trySubscribe

I strictly followed the migration guide of AngularFire and read the new documentation implementation without any success...

Here is the migration page : https://github.com/angular/angularfire/blob/master/docs/version-7-upgrade.md

Does anyone have any tips on that?

Thank you very much in advance and sorry for the possible typos.

Do not hesitate if you need more informations.

Regards.

Alex



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source