As I work on my cloud function, Firebase Firestore gets automatically imported in the following way:
import * as functions from 'firebase-functions';
import { QuerySnapshot } from '@google-cloud/firestore';
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);
const membersSnapshot: QuerySnapshot = await admin.firestore.doc('team/' + groupId + '/members').get()
However, when I try to deploy this code, an error message similar to the one below pops up. I made a slight modification as shown below, and the deployment proceeded without any errors. Yet, I am uncertain if this approach is correct.
const membersSnapshot: Array<functions.firestore.DocumentSnapshot> = await admin.firestore.doc('team/' + groupId + '/members').get()
Has anyone encountered this issue before and has any insight on it?
node_modules/@google-cloud/firestore/types/firestore.d.ts:28:15 - error TS2300: Duplicate identifier 'DocumentData'.
28 export type DocumentData = {[field: string]: any}; ~~~~~~~~~~~~
node_modules/@google-cloud/firestore/types/firestore.d.ts:35:15 - error TS2300: Duplicate identifier 'UpdateData'.
35 export type UpdateData = {[fieldPath: string]: any}; ~~~~~~~~~~
node_modules/firebase-admin/node_modules/@google-cloud/firestore/types/firestore.d.ts:1073:12 - error TS2300: Duplicate identifier 'FirebaseFirestore'.
1073 export = FirebaseFirestore; ~~~~~~~~~~~~~~~~~