Skip to content
This repository was archived by the owner on Dec 14, 2022. It is now read-only.

Conversation

@mkorenko
Copy link
Contributor

@mkorenko mkorenko commented Oct 28, 2019

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:

  1. ts error error TS2345: Argument of type 'FirebaseFirestore.Firestore' is not assignable to parameter of type 'firebase.firestore.Firestore'.
  2. 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()

@mkorenko mkorenko changed the title add Timestamp and GeoPoint types from @google-cloud/firestore fix(admin-firestore): add types from @google-cloud/firestore Nov 3, 2019
@Legogris
Copy link

Fails in CI:

src/firestore.ts
ES2015 module syntax is preferred over custom TypeScript modules and namespaces. (@typescript-eslint/no-namespace)

export namespace firestore {

@Mistic92
Copy link

Mistic92 commented Apr 4, 2020

Any update?:)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants