I've been working with Firebase cloud functions in Typescript and everything has been running smoothly. In my code, I declared variables of type DocumentReference
and GeoPoint
, which prompted VS Code to import them.
import { GeoPoint, DocumentReference } from '@google-cloud/firestore'
function offsetSlightly(location:GeoPoint) {
//some code here
return new GeoPoint(latitude, longitude)
}
After adding the necessary node module using the command
npm install @google-cloud/firestore
Everything seemed fine, but when trying to deploy, I encountered multiple "Duplicate identifier" errors for DocumentData, UpdateData, GeoPoint, and more.
Error:
node_modules/firebase-admin/node_modules/@google-cloud/firestore/types/firestore.d.ts:28:15 - error TS2300: Duplicate identifier 'DocumentData'.
28 export type DocumentData = {[field: string]: any};
Here's a snippet from my package.json {
"name": "functions",
"scripts": {
"lint": "tslint --project tsconfig.json",
"build": "tsc",
"serve": "npm run build && firebase serve --only functions",
"shell": "npm run build && firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"main": "lib/index.js",
"dependencies": {
"@google-cloud/firestore": "^0.14.1",
"firebase-admin": "^5.12.1",
"firebase-functions": "^1.0.4",
"nodemailer": "^4.6.4",
"twilio": "^3.16.0"
},
"devDependencies": {
"tslint": "^5.10.0",
"typescript": "^2.9.2"
},
"private": true
}
I'm not sure where the issue lies, but I suspect there might be conflicts in the packages. As an android developer with limited experience in Node, any assistance would be greatly appreciated.