rxfire
rxfire copied to clipboard
"Generic type 'AggregateQuerySnapshot<T>' requires 1 type argument(s)."
My Angular app won't compile with rxfire 6.0.5. The error is
Error: node_modules/rxfire/firestore/lite/interfaces.d.ts:8:29 - error TS2314: Generic type 'AggregateQuerySnapshot<T>' requires 1 type argument(s).
8 export type CountSnapshot = lite.AggregateQuerySnapshot<{
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9 count: lite.AggregateField<number>;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10 }, any, DocumentData>;
~~~~~~~~~~~~~~~~~~~~~
This is with Firebase 9.23.0. I can't get Firebase 10 to work, see my StackOverflow question.
Why is rxfire
trying to use Firestore Lite? I never imported anything from firebase/firestore/lite
.
Same issue, I temporarily fixed it by forcing it to 6.0.4.
Same issue here while using @angular/fire - fixed by installing rxfire 6.0.4 too.
Same issue here with @angular/fire but in my case installing rxfire 6.0.4 didn't help. I tried to install 6.0.3 because this was my previous version in package-lock but it didn't help too so I had to restore my whole previous package-lock where I use rxfire 6.0.3, so probably some other package makes issue too
I think the issue here is that [email protected] introduced a breaking change and now requires firebase@10 to function. So sticking to [email protected] with firebase@9 is the solution.
Adding this override to package.json resolves the issue for me:
{
"dependencies": {
"@angular/fire": "~7.6.1"
}
"overrides": {
"@angular/fire@~7.6.1": {
"rxfire@^6.0.0": "6.0.3"
}
}
}
I think the issue here is that [email protected] introduced a breaking change and now requires firebase@10 to function. So sticking to [email protected] with firebase@9 is the solution.
Adding this override to package.json resolves the issue for me:
{ "dependencies": { "@angular/fire": "~7.6.1" } "overrides": { "@angular/fire@~7.6.1": { "rxfire@^6.0.0": "6.0.3" } } }
I had commented about my temporary fix by forcing my app to use 6.0.4 but this is more reliable solution.
I was getting unexpected firebase integration errors such as "FirebaseError: Firebase: No Firebase App '[DEFAULT]' has been created - call initializeApp() first (app/no-app)". Then I tried to force 6.0.3 and these errors are also solved.
Thanks rgant.
This seems to be happening if you're using Firebase SDK Version < 10.
I was having this problem when I was using it with Firebase SDK version 9.23.0
and then I updated the Firebase SDK to version 10.5.2
and the problem went away.
This means that the issue is with rxfire
module that failed to be backward compatible to its complimentary Firebase SDK Version, specifically speaking in respect to the AggregateQuerySnapshot
class that expects 2 different types of data for the 2 versions, hence the error.
export type CountSnapshot = lite.AggregateQuerySnapshot<{ count: lite.AggregateField<number>; }, any, DocumentData>;
This is only compatible with Firebase SDK versions >10 as it expects 3 generic type datas and failed to be compatible with versions less than 10 that only expect 1 generic type data for AggregateQuerySnapshot
.
@eyoeldefare See the overrides necessary: https://github.com/FirebaseExtended/rxfire/issues/88#issuecomment-1715851191
"overrides": { "@angular/fire@~7.6.1": { "rxfire@^6.0.0": "6.0.3" } }
I tried this, I get Override for @angular/fire@^7.6.1 conflicts with direct dependency error when I perform npm install
@Steve-from-Memphis
I tried this, I get Override for @angular/fire@^7.6.1 conflicts with direct dependency error when I perform npm install
Your "dependency": { "@angular/fire": "
version` must match the override version.