Typescript-react-starter: Interface 'Element' cannot simultaneously extend types 'ReactElement<any>' and 'ReactElement<any>'.

Created on 15 Jun 2018  ยท  3Comments  ยท  Source: microsoft/TypeScript-React-Starter

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/[email protected]
โ”‚ โ””โ”€โ”€ [email protected]
โ”œโ”€โ”ฌ @types/[email protected]
โ”‚ โ”œโ”€โ”€ @types/[email protected] deduped
โ”‚ โ””โ”€โ”€ @types/[email protected] deduped

so I can't see a conflict.

Most helpful comment

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

All 3 comments

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

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

@simonccarter great that you posted this. Somehow it happened to me as well ๐Ÿ˜…

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Lxxyx picture Lxxyx  ยท  9Comments

samblake picture samblake  ยท  5Comments

user135711 picture user135711  ยท  6Comments

emanuelef picture emanuelef  ยท  3Comments

wuchaoya picture wuchaoya  ยท  9Comments