Definitelytyped: @types/react tsc failing after patch update

Created on 16 Jan 2019  路  12Comments  路  Source: DefinitelyTyped/DefinitelyTyped

  • Using the @types/react package and had problems.
  • Using the latest stable version of [email protected].

After patch upgrade from 16.7.18 to 16.7.19, tsc command in my project is failing with the following error:

node_modules/@types/react-dom/node_modules/@types/react/index.d.ts(2667,14): error TS2300: Duplicate identifier 'LibraryManagedAttributes'.
node_modules/@types/react/index.d.ts(2682,14): error TS2300: Duplicate identifier 'LibraryManagedAttributes'.
error Command failed with exit code 1.

I am not sure whether the issue lies as I am not explicitly using LibraryManagedAttributes in my project, hence logging this ticket.
Thanks.

Most helpful comment

That^ didn't work for me, but this did.

yarn remove @types/react
yarn add @types/react

All 12 comments

You're having this problem because you have duplicate packages in your node modules I think. Can you check that first?

do you mean @types/react multiple times in package.json? If that's so, then no. All the packages in my package.json are referenced only once.

Are you using yarn or npm?

yarn

https://github.com/mohsinulhaq/react-popper-tooltip
here's the repository if that helps...

You can see it in the failing branch https://github.com/mohsinulhaq/react-popper-tooltip/compare/master...mohsinulhaq:greenkeeper%2F%40types%2Freact-16.7.19

The yarn.lock file needs to be manually updated after updating the dependency to 16.7.19 so that it doesn't produce two sets of @types/react in your node_modules directory, which sometimes happens when you update a transitive dependency in both Yarn and NPM.

You can fix it by deleting both @react/types entries in your yarn.lock and re-running yarn install. Let me know if that doesn't fix it.

sure, I will try this when I get back. Will inform you about it. Thanks!

Duplicate file node_modules/@types/react-redux/node_modules/@types/react/index.d.ts

Duplicate file node_modules/@types/react-redux/node_modules/@types/react/index.d.ts

what is the solution?

@ferdaber I regenerated the yarn lockfile and now the build is passing...thanks!

That^ didn't work for me, but this did.

yarn remove @types/react
yarn add @types/react

@alex-cory - it works for me, thanks

Was this page helpful?
0 / 5 - 0 ratings