Firebase types and no-implicit-dependencies with default tslint.json
If you want to be able to import some definitions from a module, you have to declare that module as a dependency. These appear in your package.json
file under functions
. If you want to be able to import from @google-cloud/firestore
, then you need to add a dependency on it:
npm install @google-cloud/firestore
Now, you may be wondering why you can work with Firestore without declaring that dependency. That's because the Firebase Admin SDK has its own dependency on the Firestore SDK. So, when you're working with the Admin SDK directly, you gain access to objects created by the Firestore SDK. But, when you don't declare the dependency yourself, your own module can't import directly from it.
I agree with accepted answer.
Alternatively, since Admin SDK already has firestore dependancy, You can directly use admin.firestore.QuerySnapshot
, admin.firestore.DocumentSnapshot
etc. instead of installing @google-cloud/firestore
.
This is better approach. You can access everything with this.