SolvedDefinitelyTyped @types/react tsc failing after patch update

  • Using the @types/react package and had problems.
  • Using the latest stable version of tsc@3.2.2.

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.

13 Answers

✔️Accepted Answer

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

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

Other Answers:

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

You can see it in the failing branch mohsinulhaq/react-popper-tooltip@master...mohsinulhaq:greenkeeper/@types/react-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.

More Issues: