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 declaration "Component"

See original GitHub issue

Describe the bug When ever I run webpack it gives me Duplicate declaration "Component" in the generated-models.tsx file

To Reproduce Steps to reproduce the behavior:

  1. Any generated-models.tsx
  2. Run with webpack & babel typescript preset
  3. Run the following command: gql-gen ...

Expected behavior Would be not to have generated-models.tsx: Duplicate declaration "Component"

Environment:

  • OS: Mac OS Sierra
  • Codegen: 0.15.2
  • Node: v8.12.0

UPDATE: I also tried ts-loader instead of babel-loader & it gave me

TS2345: Argument of type '{ new (): Document; prototype: Document; }' is not assignable to parameter of type 'DocumentNode'.
  Type '{ new (): Document; prototype: Document; }' is missing the following properties from type 'DocumentNode': kind, definitions

UPDATE: I got ts-loader to work & compile with another generate. Babel typescript preset doesn’t support namespaces so I think that’s why it doesn’t work.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
harrisrobincommented, Jan 30, 2019

@dragonfire1119 im running into the same issue…

Duplicate declaration "Document"

How did you get around this? do you mind providing more details?

2reactions
dotansimhacommented, Feb 3, 2019

@harrisrobin You can use noNamepsaces configuration and the output will work with CRA (see https://graphql-code-generator.com/docs/integrations/create-react-app)

Read more comments on GitHub >

github_iconTop Results From Across the Web

reactjs - Duplicate declaration "Form" - React - Stack Overflow
I'm using React with two different components: Formsy and React Router Form. ... Duplicate declaration "Form" while parsing file: C:\Users.
Read more >
Duplicate declaration in current scope | Microsoft Learn
In this article. Check the current procedure, module, or project and remove any duplicate declarations. A Const statement uses the same name as ......
Read more >
Duplication declaration error fix? - MIT App Inventor Help
I've been trying to get my project on my phone but the duplication declaration error won't let me.
Read more >
Module Build Failed: Duplicate Declaration "Editor"-Reactjs
Coding example for the question Module Build Failed: Duplicate Declaration "Editor"-Reactjs.
Read more >
React-Redux import : duplicate declaration ? : r/reactjs - Reddit
Hi guys ! I'm a beginner in Redux and when trying to import a component I created, I have this error : Duplicate...
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