Open vthommeret opened 2 years ago
@vthommeret Thanks for reporting this. We are building with 4.x ourselves. I will see if we can support both versions, but it will take a couple of days.
What version of TypeScript are you using?
4.5.4
I am not able to reproduce this error using a new project. Are you able to share a test projects? I tested both using a blank project and using the firebase-functions project as created by the Firebase CLI.
OK I figured out the issue as I was running into other dependencies that wouldn't pass type checking. While my global TypeScript was 4.5.4, it looks like the default TypeScript installed when you do firebase init
and choose "functions" is 3.8.0:
https://github.com/firebase/firebase-tools/blob/master/templates/init/functions/typescript/package.lint.json#L27 https://github.com/firebase/firebase-tools/blob/master/templates/init/functions/typescript/package.nolint.json#L20 https://github.com/firebase/firebase-tools/blob/master/templates/extensions/typescript/package.lint.json#L15 https://github.com/firebase/firebase-tools/blob/master/templates/extensions/typescript/package.nolint.json#L12
When I manually upgraded the local TypeScript to 4.5.5, I was able to build 5.0.2. Is this an issue that should be filed in the firebase-tools project?
The version of Firebase Tools I'm running is 10.1.0 / it's strange that it compiles for you when created via the Firebase CLI since it seems like 3.8.0 is part of the base template.
We have not yet updated the @google-cloud/firestore
dependency of firebase-admin yet. This is a prerequisite which should allow us to update firebase-functions and the CLI. I will follow up internally.
To confirm, I'm having the same issue. However, I was able to build with TS ^3.8.0
& Firestore ^4.15.1
I too have run into the same issue.
The clash appears to be related to a namespace declaration with firebase-admin
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, BulkWriter, BulkWriterError, WriteBatch, SetOptions, WriteResult, DocumentReference, DocumentSnapshot, QueryDocumentSnapshot, OrderByDirection, WhereFilterOp, Query, QuerySnapshot, DocumentChangeType, CollectionReference, CollectionGroup, QueryPartition, FieldValue, FieldPath, Timestamp, BundleBuilder, v1beta1, v1, OK, CANCELLED, UNKNOWN, INVALID_ARGUMENT, DEADLINE_EXCEEDED, NOT_FOUND, ALREADY_EXISTS, PERMISSION_DENIED, RESOURCE_EXHAUSTED, FAILED_PRECONDITION, ABORTED, OUT_OF_RANGE, UNIMPLEMENTED, INTERNAL, UNAVAILABLE, DATA_LOSS, UNAUTHENTICATED, 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.
package.json snippet
"dependencies": {
"@algolia/client-search": "^4.13.0",
"@google-cloud/firestore": "^5.0.2",
"@google-cloud/pubsub": "^2.19.0",
"@google-cloud/storage": "^5.19.0",
"@google-cloud/vision": "^2.4.2",
"@googlicius/build-url": "^1.0.11",
"@types/node": "^17.0.23",
"@types/node-fetch": "^2.6.1",
"algoliasearch": "^4.13.0",
"csv-parse": "^5.0.4",
"firebase-admin": "^10.0.2",
"firebase-dynamic-links": "^1.1.0",
"firebase-functions": "^3.20.0",
"handlebars": "^4.7.7",
"jimp": "^0.16.1",
"line-segmentation-algorithm-to-gcp-vision": "^1.0.2",
"node-fetch": "2.6.7",
"yup": "^0.32.11"
},
"devDependencies": {
"@firebase/rules-unit-testing": "^2.0.2",
"@types/faker": "5.5.9",
"@types/jest": "^27.4.1",
"@typescript-eslint/eslint-plugin": "^5.18.0",
"@typescript-eslint/parser": "^5.18.0",
"eslint": "^8.12.0",
"eslint-plugin-import": "^2.26.0",
"faker": "5.5.3",
"firebase-functions-test": "^0.3.3",
"jest": "^27.5.1",
"jest-fetch-mock": "^3.0.3",
"ts-jest": "^27.1.4",
"ts-mockito": "^2.6.1",
"ts-node": "^10.7.0",
"typescript": "^4.6.3",
"yargs": "^17.4.0"
},
I am experiencing the same as above after trying to update @google-cloud/firestore
and firebase-admin
to latest versions. Given this problem was acknowledged almost 4 months ago, is there an ETA for a fix or an update?
Hello All. I'm taking over this issue from @schmidt-sebastian but, unfortunately, I don't have the breadth of knowledge that he had. Could someone provide a GitHub repo that I could clone to reproduce this problem?
I can provide a code snippet that is giving me a typescript error if that is helpful.
Code:
return admin()
.firestore()
.runTransaction(async (t) => {
const doc: any = await t.get(goalSnap.ref);
const updatedRun = {
status: "running",
startTime: moment().valueOf(),
};
t.update(doc.ref, {
[databaseConstants.users.goals.analysisEngineRuns]: updatedRun,
});
return false;
});
TS error:
Argument of type '{ [x: string]: { status: string; startTime: number; }; }' is not assignable to parameter of type '{ [x: string]: FieldValue | { status?: string | FieldValue | undefined; startTime?: number | FieldValue | undefined; } | undefined; } & AddPrefixToKeys<string, { ...; }>'.
Type '{ [x: string]: { status: string; startTime: number; }; }' is not assignable to type 'AddPrefixToKeys<string, { status?: string | FieldValue | undefined; startTime?: number | FieldValue | undefined; }>'.
'string' and '`${string}.status`' index signatures are incompatible.
Type '{ status: string; startTime: number; }' is not assignable to type 'string | FieldValue | undefined'.ts(2345)
This error is specifically referring to the second argument of the t.update
function
This is with "@google-cloud/firestore": "^5.0.2"
and "firebase-admin": "^11.0.0"
Hey @dconeybe, any updates on this?
No updates. I would love to dive into this more, but my time is limited. If someone could provide a git repo that I could clone and reproduce that would make it much quicker for me to investigate :wink: :wink:
Environment details
@google-cloud/firestore
version: 5.0.2Steps to reproduce
npm run build
within Firebase Functions folderOutput
I see this on 5.0.0, 5.0.1, and 5.0.2. Running on 4.15.1 I see no errors.