question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Could not find a declaration file for module 'prop-types'

See original GitHub issue

I’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:closed
  • Created 6 years ago
  • Reactions:7
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
Robinfrcommented, Apr 6, 2018

This is still happening.

0reactions
HamidTanhaeicommented, Sep 4, 2018

same issue

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found