microsoft / TypeScript-React-Starter

A starter template for TypeScript and React with a detailed README describing how to use the two together.
MIT License
11.09k stars 1.21k forks source link

Interface 'Element' cannot simultaneously extend types 'ReactElement<any>' and 'ReactElement<any>'. #152

Closed simonccarter closed 6 years ago

simonccarter commented 6 years ago

Followed the instructions on the main README.md. Have not edited/altered the project after installation.

I get the following error after running npm run start:

Failed to compile.

/some/path/my-app/node_modules/@types/react/index.d.ts
(2234,19): Interface 'Element' cannot simultaneously extend types 'ReactElement<any>' and 'ReactElement<any>'.
  Named property 'type' of types 'ReactElement<any>' and 'ReactElement<any>' are not identical.

I have also followed the instructions here:

https://basarat.gitbooks.io/typescript/docs/errors/main.html#interface-elementclass-cannot-simultaneously-extend-types-component-and-component

I've also, using nvm, uninstalled my node version (10.1.0), switching to a new version (8.9.4), incase there was a different version of the @type/react polluting my global modules.

If I run npm list | less, the only entries with @types/react are:

├─┬ @types/react@16.3.17
│ └── csstype@2.5.3
├─┬ @types/react-dom@16.0.6
│ ├── @types/node@10.3.3 deduped
│ └── @types/react@16.3.17 deduped

so I can't see a conflict.

simonccarter commented 6 years ago

Closing. Stupidly managed to install @types/react in an ancestor folder.

adamoverton commented 6 years ago

I actually also stupidly managed to have a node_modules like three directories above my project directory, and sure enough, it found it! Darn!

sroze commented 6 years ago

@simonccarter great that you posted this. Somehow it happened to me as well 😅