question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Duplicate identifier error

See original GitHub issue

Describe the bug Duplicate resolver type is generated.

To Reproduce

  1. Define field category_sports: category as schema. (single underscore)
  2. Define another field category__sports: [category] as schema. (double underscore)
  3. Run the following command: gql-gen -s http://somewhere/graphql -t graphql-codegen-typescript-template -o ./src/resolvers/types.ts ./src/resolvers/query.ts
  4. Run the following command: tsc -p . src/resolvers/types.ts - error TS2300: Duplicate identifier ‘CategorySportsResolver’.

Expected behavior No error message.

Environment:

  • OS: macOS High Sierra
  • Codegen: graphql-code-generator v0.12.5, graphql-codegen-typescript-template@0.12.5
  • Node: v8.12.0

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:9
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

32reactions
panzerdpcommented, May 25, 2019

@dotansimha @danbruegge, Faced the same problem.

It happens because "pluginCreator___id" and "pluginCreatorId" using change-case#pascalCase is transformed into the same PluginCreatorId.

Changing the enum transformer name convention to keep solved the problem:

# codegen.yaml
config:
  namingConvention:
    enumValues: keep
5reactions
danbrueggecommented, May 7, 2019

Hi, looks like this error is back again? We have a simple GatsbyJS+StrapiJS stack.

This is what i get:

src/graphqlTypes.ts:868:3 - error TS2300: Duplicate identifier 'PluginCreatorId'.

868   PluginCreatorId = "pluginCreator___id",
      ~~~~~~~~~~~~~~~

src/graphqlTypes.ts:932:3 - error TS2300: Duplicate identifier 'PluginCreatorId'.

932   PluginCreatorId = "pluginCreatorId",

Do you need further infos?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Confusing "duplicate identifier" Typescript error message
When I ran npm start , I got a bunch of duplicate identifier errors. SOLUTION: From the project root folder run: rm -r...
Read more >
Duplicate identifier error in TypeScript | bobbyhadz
Another common cause of the "Duplicate identifier error" error is - your project is pulling in typings from multiple versions of a package....
Read more >
How to fix the "duplicate identifier" error in TypeScript
If the answer to the previous question is yes, then you just found the reason to the “duplicate identifier” error. Remove the lines...
Read more >
How to fix: Duplicate identifier - Google Merchant Center Help
How to fix: Duplicate identifier · Step 1: See the affected products · Step 2: Remove the duplicate · Step 3: Resubmit your...
Read more >
Troubleshooting duplicate or missing identifier error messages
Learn about duplicate identifier errors and how to resolve them in your list uploads. If you're encountering a different error message, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found