I tried using the @types/[email protected] package and had problems.
ERROR in [at-loader] ./node_modules/@types/react-router/index.d.ts:69:13
TS2315: Type 'Location' is not generic.
This is correct, the version of @types/history that this package depends on does not have a generic Location type. However the current version in master does.
cc @sergey-buturlakin, @ngbrown, @rokoroku
Perhaps related to #27012.
Seems the package is being distributed without the correct dependency on @types/history:
From package.json
"dependencies": {
"@types/react": "*",
"@types/history": "*"
},
Updating to "@types/history": "4.7.0", fixed this for me.
Thanks for the hint.
Ah, I fixed this by removing and re-adding @types/react-router and @types/react who both depend on the package. My package does not depend on @types/history so I could not update it directly, and the subdependency is not updated with yarn upgrade --latest @types/react-router. However, when it's added for the first time it will be locked to latest.
@rhys-vdw Thanks for the hint. Doing what you described didn't work for me for some reason, but it pointed me in the right direction: I just went in and modified the yarn.lock to get myself unstuck from that state.
update your react-router or add {"skipLibCheck": true} to your tsconfig.json
Most helpful comment
Updating to
"@types/history": "4.7.0",fixed this for me.Thanks for the hint.