[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error TS2374: Duplicate index signature for type 'string' #2190

Open
nicklbaert opened this issue May 23, 2023 · 6 comments
Open

error TS2374: Duplicate index signature for type 'string' #2190

nicklbaert opened this issue May 23, 2023 · 6 comments
Assignees

Comments

@nicklbaert
Copy link
nicklbaert commented May 23, 2023

[READ] Step 1: Are you in the right place?

Yes

[REQUIRED] Step 2: Describe your environment

  • Operating System version: Github Actions
  • Firebase SDK version: 11.8.0
  • Firebase Product: firestore
  • Node.js version: v18.16.0
  • NPM version: 11.8.0

[REQUIRED] Step 3: Describe the problem

Steps to reproduce:

I'm simply trying to run npm run build whilst using version 11.8.0 of the firebase-admin node package.

Github Actions fails with the following output:

node_modules/@google-cloud/firestore/types/firestore.d.ts(23,1): error TS6200: Definitions of the following identifiers conflict with those in another file: DocumentFieldValue, DocumentData, PartialWithFieldValue, WithFieldValue, UpdateData, Primitive, NestedUpdateFields, ChildUpdateFields, AddPrefixToKeys, UnionToIntersection, Firestore, GeoPoint, Transaction, BulkWriter, BulkWriterError, WriteBatch, SetOptions, WriteResult, DocumentReference, DocumentSnapshot, QueryDocumentSnapshot, OrderByDirection, WhereFilterOp, Query, QuerySnapshot, DocumentChangeType, CollectionReference, CollectionGroup, QueryPartition, AggregateField, AggregateFieldType, AggregateSpecData, AggregateQuery, AggregateQuerySnapshot, 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, Filter, FirebaseFirestore
node_modules/@google-cloud/firestore/types/firestore.d.ts(302,5): error TS2374: Duplicate index signature for type 'string'.
node_modules/@google-cloud/firestore/types/firestore.d.ts(2085,5): error TS2374: Duplicate index signature for type 'string'.
../../../../node_modules/@google-cloud/firestore/types/firestore.d.ts(23,1): error TS6200: Definitions of the following identifiers conflict with those in another file: DocumentFieldValue, DocumentData, PartialWithFieldValue, WithFieldValue, UpdateData, Primitive, NestedUpdateFields, ChildUpdateFields, AddPrefixToKeys, UnionToIntersection, Firestore, GeoPoint, Transaction, BulkWriter, BulkWriterError, WriteBatch, SetOptions, WriteResult, DocumentReference, DocumentSnapshot, QueryDocumentSnapshot, OrderByDirection, WhereFilterOp, Query, QuerySnapshot, DocumentChangeType, CollectionReference, CollectionGroup, QueryPartition, AggregateField, AggregateFieldType, AggregateSpecData, AggregateQuery, AggregateQuerySnapshot, 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, Filter, FirebaseFirestore
../../../../node_modules/@google-cloud/firestore/types/firestore.d.ts(302,5): error TS2374: Duplicate index signature for type 'string'.
../../../../node_modules/@google-cloud/firestore/types/firestore.d.ts(2085,5): error TS2374: Duplicate index signature for type 'string'.
npm ERR! Lifecycle script `build` failed with error: 
npm ERR! Error: command failed 
npm ERR!   in workspace: ...
npm ERR!   at location: ...
Error: Process completed with exit code 1.

Relevant Code:

package.json:

"dependencies": {
    "firebase-admin": "^11.8.0",
    "firebase-functions": "^4.4.0",
    "pg": "^8.10.0"
  },
"devDependencies": {
    "@types/pg": "^8.6.6",
    "firebase-functions-test": "^3.0.0"
}
@milaGGL milaGGL self-assigned this May 23, 2023
@milaGGL
Copy link
milaGGL commented May 23, 2023

Hi @nicklbaert, based on the error message, seems like some functions has been imported from different sources. Could you please double check all the files and make sure the importation are the same?

Meanwhile, there is a similar issue ticket: #734. Adding skipLibCheck in tsconfig might be a workaround.

@nicklbaert
Copy link
Author
nicklbaert commented May 23, 2023

Hey @milaGGL, thank you for your time and the quick response.
I've double checked everything. The error also occurred seemingly overnight without any relevant changes to our code.
Could it maybe be related to the fact that @google-cloud/firestore recently had a new update to version 6.6.0 whilst firebase-admin still uses 6.5.0?

@milaGGL
Copy link
milaGGL commented May 23, 2023

With pleasure. So it was working all fine before, but suddenly started crashing overnight without a change. Have you upgraded any packages in your app?

@nicklbaert
Copy link
Author
nicklbaert commented May 24, 2023

@milaGGL We had the same CI running without problems 2 days ago. Since then no packages have been changed. Maybe also worth noting, that the failing command npm run build runs locally without issues. The problem seems to occur only in Github Actions.

@PaulFidika
Copy link
PaulFidika commented Mar 10, 2024

I had this same problem. It sent me down tsconfig-hell for 4+ hours trying to figure it out. ChatGPT 4 has no clue wtf is happening either.

This happened to me because I had a repo with 3 folders; /server /common /worker. They all had firebase-admin package installed (same version), and /server and /worker are both importing from /common. I removed firebase-admin as a dependency in /worker and stopped relying on it, and turned /common into its own local package using a yarn workspace monorepo for all 3, and then had both /worker and /server treat /common as a proper npm-dependency rather than just a folder they both import from.

Honestly tsconfig / package.json and all these weird build configurations are just far too complex. 'dev' mode with ts-node and 'prod' mode with node are like two separate conflicting runtime environments that can't agree on how to resolve import paths or dependencies.

@milaGGL
Copy link
milaGGL commented Mar 11, 2024

Hi @PaulFidika, thank you for sharing this issue. Would it be possible to provide a minimal code so that I can reproduce it on my end?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants