zzarcon / ts-react-toolbox

Opinionated toolbox boilerplate to create Typescript React components 🛠:package:
MIT License
23 stars 5 forks source link

@types/react should be listed in peerDependencies #20

Open theKashey opened 4 years ago

theKashey commented 4 years ago

https://github.com/gaearon/react-hot-loader/issues/1359

However, you don't specify the dependency for @types/react, which causes issues in projects where TypeScript compiler is running in "strict" mode and where dependencies are installed by a more strict package manager like pnpm (Rush).

It gives the following TypeScript error during application compilation:


TS7016: Could not find a declaration file for module 'react'.
'~/app/common/temp/node_modules/.registry.npmjs.org/react/16.10.2/node_modules/react/index.js' implicitly has an 'any' type.
zzarcon commented 4 years ago

Good point. Is this only affecting peer deps? Just wondering what happens if you use or re expose a type from your lib, should that be listed as well?

theKashey commented 4 years ago

Probably no. You shall only "depend" on it, so the package manager would understand it.