Could not find a declaration file for module 'prop-types'
See original GitHub issueI’ve created a new project using create-react-app-typescript and added the simple Formik example from the readme but I got a compile error right away:
error TS7016: Could not find a declaration file for module 'prop-types'.
I think this is due to the @types/prop-types
package being included in Formik’s devDependencies
and not dependencies
. Based on the TypeScript publishing doc, it seems like including the dependency in dependencies
would be an appropriate way to manage it and should resolve this issue. Unfortunately, non-TS projects would bring down the dependency, but the alternative is requiring TS projects to manage a dependency their code doesn’t depend on.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:7
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Could not find a declaration file for module 'prop-types' #2254
It was solved by installing @types/prop-types. npm i -D @types/prop-types. Should that be added as a dependency for office-ui-fabric-react ...
Read more >Could not find a declaration file for module ''react-materialize ...
I had a similar error but for me it was react-router . Solved it by installing types for it. npm install --save @types/react-router....
Read more >deprecated-react-native-prop-types - npm
Start using deprecated-react-native-prop-types in your project by running `npm i ... github.com/facebook/react-native-deprecated-modules ...
Read more >Section 3: Misc. Concerns - React TypeScript Cheatsheets
propTypes may seem unnecessary with TypeScript, especially when building React + TypeScript ... Could not find a declaration file for module 'de-indent'.
Read more >How to fix error TS7016: Could not find a declaration file for ...
Try `npm install @types/XYZ` if it exists or add a new declaration (.d. · declare module 'XYZ';. Lastly, you also need to add...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is still happening.
same issue