Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

@types/node/index.d.ts(138,13): error TS2300: Duplicate identifier 'require' #19

Open
ekapasha17 opened this issue Dec 25, 2017 · 7 comments

Comments

@ekapasha17
Copy link

ekapasha17 commented Dec 25, 2017

I got several error when I following this guide
and there's error about jsx : error TS2604: JSX element type 'Index' does not have any construct or call signatures
image
image

@changtimwu
Copy link

This workground works for me.
DefinitelyTyped/DefinitelyTyped#15960 (comment)

@ekapasha17
Copy link
Author

@changtimwu solved,I added "types": ["react", "react-native", "jest"] to my tsconfig
but I still dont understand,what it does,maybe you can explain it ("types": ["react", "react-native", "jest"])

@vladinator1000
Copy link

vladinator1000 commented Dec 29, 2017

Adding "types" to tsconfig.json didn't work for me

Edit: because I didn't know you're supposed to add them under "compilerOptions"...

{
  "compilerOptions": {
    "types": ["react", "react-native", "jest"],
    // ...
  }
} 

@stewhi
Copy link

stewhi commented Mar 15, 2018

@savovs, Nice catch, that helped me a lot.

Unfortunately, when the compiler skips node, I still get errors, my project has dependencies on both node and react-native. Has there been any progress on this? Or are node and react-native mutually exclusive?

@StevenTCramer
Copy link

@lVlario0O0o
Copy link

When I remove the node types it gives me a lot of errors...

@nathguen
Copy link

Adding "types" to tsconfig.json didn't work for me

Edit: because I didn't know you're supposed to add them under "compilerOptions"...

{
  "compilerOptions": {
    "types": ["react", "react-native", "jest"],
    // ...
  }
} 

For me, all I needed was:

{
  "compilerOptions": {
    "types": ["react"],
    // ...
  }
} 

... but this was a life saver!

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

No branches or pull requests

7 participants