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
[TypeScript Resolvers] Some combinations of type names and field names causes duplicate identifier errors #1954
Comments
@dobesv can you please share the codegen and plugins version, and the output you got? |
I created a minimal reproduction here: https://github.com/dobesv/graphql-codegen-1954 Check out the repo and run |
I deleted comment as it was my mistake and graphql-code-generator was works perfectly. I'm sorry for noise 🙇♂️ |
Hi @dobesv, I noticed that your repro is using a very old version of the codegen (0.18.2). I tested the latest version with the updated dependencies: {
"name": "graphql-codegen-1954",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {},
"devDependencies": {
"@graphql-codegen/cli": "1.3.1",
"graphql": "^14.3.1",
"@graphql-codegen/typescript-resolvers": "1.3.1",
"@graphql-codegen/typescript": "1.3.1"
},
"scripts": {
"repro": "gql-gen && tsc resolverTypes.ts"
}
} And this config file: overwrite: true
schema: Repro.graphql
generates:
./resolverTypes.ts:
config:
scalars:
Date: Date
JSON: any
plugins:
- typescript
- typescript-resolvers
And everything seems to work, no compiler errors. |
I am on the latest version of graphql-codegen and still getting an error like this: "Duplicate identifier 'PullRequestReviewThreadsArgs'" when running against the full GitHub GraphQL API (reference for how to set that up is in #2105) I am on 1.3.1 across all plugins. |
@mxstbr I tried now with the latest, it seems like it compiles correctly (there is only one Can you please create a minimal reproduction for this? |
Hmm interesting, it might be because I am an employee and am hitting an internal GraphQL API. Let me try to get you a minimal reproduction! |
I found the issue, this is the most minimal reproduction: type PullRequest {
reviewThreads(first: Int!): Int
}
type PullRequestReview {
threads(first: Int!, last: Int!): Int
} This generates two types with the same name, @dotansimha do you think you can fix it with this information? |
Submitted a failing test as a PR: #2111 This should hopefully help you fix this @dotansimha! |
Fixed in: 0e67020 |
Fixed in 1.4.0 🎉 |
Is your feature request related to a problem? Please describe.
I have a situation like:
When resolver types are generated, it generated two types with the same name
WhateverItemTags
.Describe the solution you'd like
Ideally I could somehow rename the resolver type for one of these.
Describe alternatives you've considered
I think the only way to work around this is to assign a different name to one of the fields.
The text was updated successfully, but these errors were encountered: