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

"Generic type 'AggregateQuerySnapshot<T>' requires 1 type argument(s)." #88

Open
tdkehoe opened this issue Sep 1, 2023 · 10 comments
Open

Comments

@tdkehoe
Copy link

tdkehoe commented Sep 1, 2023

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.

@tdkehoe
Copy link
Author

tdkehoe commented Sep 1, 2023

Why is rxfire trying to use Firestore Lite? I never imported anything from firebase/firestore/lite.

@msapcili
Copy link

msapcili commented Sep 1, 2023

Same issue, I temporarily fixed it by forcing it to 6.0.4.

@igoraugustynski
Copy link

Same issue here while using @angular/fire - fixed by installing rxfire 6.0.4 too.

koalter added a commit to koalter/rxfire that referenced this issue Sep 8, 2023
@hvma411
Copy link

hvma411 commented Sep 9, 2023

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

@rgant
Copy link

rgant commented Sep 12, 2023

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"
    }
  }
}

@msapcili
Copy link

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.

xylo04 added a commit to RMHAM/co-ares-catalog that referenced this issue Oct 20, 2023
xylo04 added a commit to RMHAM/co-ares-catalog that referenced this issue Oct 20, 2023
xylo04 added a commit to RMHAM/co-ares-catalog that referenced this issue Oct 20, 2023
@eyoeldefare
Copy link

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.

@rgant
Copy link

rgant commented Nov 7, 2023

@eyoeldefare See the overrides necessary: #88 (comment)

@Steve-from-Memphis
Copy link

  "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

@rgant
Copy link

rgant commented Nov 20, 2023

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants