Closed adriansergheev closed 3 years ago
Could you also show your import statement?
import * as GeoFire from 'geofire';
Thanks!
Oh, I remembered. It happened to me too. The reason of error is that when GeoFire is being initialized, it requires Reference
typed object without the path
property but firebase-admin creates Reference
typed object with the path
property. Use the code below to fix the typing error:
var geoFireDB = new GeoFire.GeoFire(database as unknown as GeoFire.GeoFireTypes.firebase.Reference);
So, basically what id does: first, it transforms firebase-admin's Reference
typed object's type to unknown
and then to GeoFire's Reference
type.
@andriansergheev any success?
Works. I'm coming from a strong-typed world and this kind of dances are incomprehensible for my brain, Thanks again,
You are welcome.
This piece of code:
Does not work. Error:
Argument of type 'import("").admin.database.Reference' is not assignable to parameter of type 'import("").Reference'. The types of 'push(...).endAt(...).isEqual' are incompatible between these types.
Type '(other: import("functions/node_modules/firebase-admin/lib/database").admin.database.Query | null) => boolean' is not assignable to type '(other: import("/cloudFunctions/functions/node_modules/@firebase/database-types/index").Query | null) => boolean'. Types of parameters 'other' and 'other' are incompatible. etc.
Here is what I have defined in package.json: "firebase": "^7.24.0", "firebase-admin": "^8.12.1", "firebase-functions": "^3.11.0", "geofire": "^5.0.1",
Any ideas?