question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

FireStore Collection Query Error: Types of property 'firestore' are incompatible.

See original GitHub issue

Version info

Angular: 5.2.5

Firebase: 4.9.1

AngularFire: 5.0.0-rc.6

Other (e.g. Ionic/Cordova, Node, browser, operating system):

How to reproduce these conditions

Failing test unit, Plunkr, or JSFiddle demonstrating the problem

Use the Stackblitz example provided in docs with compound query or similar with versions above.

In my case I had this code that DOES NOT give error on version 5.0.0-rc.4 (& firebase 4.9.1) but does on 5.0.0-rc.6

this.shops$ = this.afs.collection<IShop>('shops', ref => {
  let query: firebase.firestore.CollectionReference | firebase.firestore.Query = ref;

Debug output

** Errors in the JavaScript console **

Argument of type '(ref: CollectionReference) => CollectionReference | Query' is not assignable to parameter of type 'QueryFn'.
  Type 'CollectionReference | Query' is not assignable to type 'Query'.
    Type 'CollectionReference' is not assignable to type 'Query'.
      Types of property 'firestore' are incompatible.
        Type 'Firestore' is not assignable to type 'FirebaseFirestore'.
          Property 'enableNetwork' is missing in type 'Firestore'.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:5
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

8reactions
jeremybencommented, Mar 13, 2018

Use types added with recent firebase updates : import { Query } from '@firebase/firestore-types'

Then simply cast your reference to a query like so : let query: Query = ref;

No need for union type anymore, since the CollectionReference type inherits his methods from Query type.

0reactions
jamesdanielscommented, May 4, 2018

Sounds like your dependencies are messed up, make sure your up to date with both the Firebase JS SDK versions and the types.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Firestore Collection: Compound Query fails with AngularFire2 ...
Type 'CollectionReference | Query' is not assignable to type 'Query'. Type 'CollectionReference' is not assignable to type 'Query'. Types of ...
Read more >
firebase/firestore - JavaScript API reference - Google
Since query results contain only existing documents, the exists property will always be true and data() will never return 'undefined'.
Read more >
Getting data | Firestore - Google Cloud
There are three ways to retrieve data stored in Firestore. Any of these methods can be used with documents, collections of documents, or...
Read more >
Cloud Firestore | FlutterFire
Cloud Firestore gives you the ability to read the value of a collection or ... the docs property, which returns a List containing...
Read more >
property 'firestore' does not exist on type - You.com
firestore().collection("cities"); I get the error "Property 'firestore' does not exist on type 'typeof firebase'." How should ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found