Firebase-admin-node: [Firestore] Type definitions are in conflict with @google-cloud/firestore v 3.0.0

Created on 18 Dec 2019  路  10Comments  路  Source: firebase/firebase-admin-node

3.0.0 was only released yesterday, so not unexpected but still

node_modules/@google-cloud/firestore/types/firestore.d.ts:23:1 - error TS6200: Definitions of the following identifiers conflict with those in another file: DocumentData, UpdateData, Firestore, GeoPoint, Transaction, WriteBatch, WriteResult, DocumentReference, DocumentSnapshot, QueryDocumentSnapshot, OrderByDirection, WhereFilterOp, Query, QuerySnapshot, DocumentChangeType, CollectionReference, FieldValue, FieldPath, Timestamp, v1beta1, v1, FirebaseFirestore

23 declare namespace FirebaseFirestore {
   ~~~~~~~

  node_modules/firebase-admin/node_modules/@google-cloud/firestore/types/firestore.d.ts:23:1
    23 declare namespace FirebaseFirestore {
       ~~~~~~~
    Conflicts are in this file.
  • Operating System version: Mac OS X 10.14.4
  • Firebase SDK version: 7.6.0
  • Firebase Product: Firestore
  • Node.js version: 11.9.0
  • NPM version: 6.13.4
needs-triage

Most helpful comment

Seeing this same error now too.

Currently have the following packages:

    "firebase-admin": "^8.12.1",
    "@google-cloud/firestore": "^3.8.0",

Adding skipLibCheck in tsconfig to true allows me to continue, but ideally we don't want to do that.

All 10 comments

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@arpit Thanks for the report. You seem to be using two different versions of Firestore (one from node_modules/@google-cloud/firestore and one from node_modules/firebase-admin/node_modules/@google-cloud/firestore). As shown in your errors, this breaks the TypeScript compile.

We haven't yet updated Firebase Admin to include Firestore 3.0. If you want to avoid this problem, you can install Firebase Admin from this branch:

"dependencies": {
   "firebase-admin": "git+https://github.com/firebase/firebase-admin-node.git#firestore-30"
}

@schmidt-sebastian We are currently using firebase-admin 8.10.0 and facing this issue. Does it mean firestore 3.0 is not yet into the admin module?

So any reason why its still showing the confict?

I have seen cases like this before when two version of Firestore were included via NPM's dependency resolution. This doesn't necessarily have to be related to Firebase Admin.

Ok, Here is our scenario.
We installed both firebase-admin as well as @google-cloud/firestore in our project.
The reason why we had @google-cloud/firestore is

  1. To connect to local firestore emulator during our tests. (emulators:exec is buggy to use)
  2. We need to connect to a different firestore project from the current project.

What we have observed is nested node-modules folder with in the node-modules/firebase-admin has @google-cloud/firestore types too leading to the issue. We see it a general use case too as its quite common to use @google-cloud/firestore package.

This issue didn't happen earlier but only on upgrading to latest firebase-admin.

To solve it temporarily, we just deleted the types file listed in firebase-admin to avoid the conflicting error. But we see it would be great if there is a right solution.

google-cloud-firestore
firebase-admin

You should be able to use @google-cloud/firestore and firebase-admin together if they point to the same version. NPM will not duplicate the package if the version can be shared.

Seeing this same error now too.

Currently have the following packages:

    "firebase-admin": "^8.12.1",
    "@google-cloud/firestore": "^3.8.0",

Adding skipLibCheck in tsconfig to true allows me to continue, but ideally we don't want to do that.

@asithade thank you for the workaround.

Was this page helpful?
0 / 5 - 0 ratings