FireStore Collection Query Error: Types of property 'firestore' are incompatible.
See original GitHub issueVersion 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:
- Created 6 years ago
- Reactions:5
- Comments:5 (1 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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.
Sounds like your dependencies are messed up, make sure your up to date with both the Firebase JS SDK versions and the types.