When initializing an app using firebase-admin with admin.firestore() instead of firebase.firestore():
import * as functions from 'firebase-functions';
admin.initializeApp(functions.config().firebase);
const firestore = admin.firestore();
firestorm.initialize(firestore);
getting:
ts error error TS2345: Argument of type 'FirebaseFirestore.Firestore' is not assignable to parameter of type 'firebase.firestore.Firestore'.
after fixing it, getting runtime error for @timestamp() and @geopoint() fields : TypeError: Cannot read property 'Timestamp' of undefined
I guess that happens because different types are imported by non-admin and admin SDKs:
from firebase/index.d.ts and @google-cloud/firestore/types/firestore.d.ts respectively.
Fixed that for TimeStamps and GeoPoints using combined types/fallback refs, and also types in firestorm.initialize()
When initializing an app using firebase-admin with
admin.firestore()
instead offirebase.firestore()
:getting:
error TS2345: Argument of type 'FirebaseFirestore.Firestore' is not assignable to parameter of type 'firebase.firestore.Firestore'.
@timestamp()
and@geopoint()
fields :TypeError: Cannot read property 'Timestamp' of undefined
I guess that happens because different types are imported by non-admin and admin SDKs: from
firebase/index.d.ts
and@google-cloud/firestore/types/firestore.d.ts
respectively.Fixed that for TimeStamps and GeoPoints using combined types/fallback refs, and also types in firestorm.initialize()