Definitelytyped: @types/enzyme breaks with typescript 2.9

Created on 7 Jun 2018  路  7Comments  路  Source: DefinitelyTyped/DefinitelyTyped

@MarianPalkus @NoHomey @andy-ms
types/enzyme fails with typescript 2.9.1

Error
Interface 'Element' cannot simultaneously extend types 'ReactElement<any>' and 'ReactElement<any>'. Named property 'type' of types 'ReactElement<any>' and 'ReactElement<any>' are not identical.

Most helpful comment

I had similar problem, but it was merely with yarn dependency resolution. Try remove yarn.lock and install deps again. solved that issue for me ( clean shallow dependency tree, no react types duplicates )

All 7 comments

@harry-sm Could you clarify how you're getting this error? cd types/enzyme and tsc doesn't show any error.

@andy-ms
All I did was update my project typescript dev dependency to 2.9.1 and then tried to run the project which resulted in that error.
image

I notice that the path is node_modules/@types/enzyme/node_modules/@types/react. That probably indicates you have two different versions of @types/react installed, which likely causes the error.

Ok I'll try and update my @types/react and see what happens.

@andy-ms
So updated my @types/react and got the same error. I went into the node_modules folder and saw that @types/enzyme is using @types/react v16.0.40. I switched to that version and the error is gone but now other packages are broken. I was using v16.3.17 before.

I had similar problem, but it was merely with yarn dependency resolution. Try remove yarn.lock and install deps again. solved that issue for me ( clean shallow dependency tree, no react types duplicates )

@Hotell Thanks that fixed the issue and some others I have been having :).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JudeAlquiza picture JudeAlquiza  路  3Comments

demisx picture demisx  路  3Comments

variousauthors picture variousauthors  路  3Comments

csharpner picture csharpner  路  3Comments

alisabzevari picture alisabzevari  路  3Comments