React Native - prop-types module: Default export is not declared in imported module

Hi! In a React Native project, I get this warning:

I tried to reproduce the warning in a fresh React Native project, but in the new project the warning is not shown. So something must be different in the project where the message is shown, but I don't know what.

Any idea?

Regards, Stefan


You must have prop-types typings (npm i @types/prop-types) installed in your project - node_modules/@types/prop-types/index.d.ts doesn't have any default exports declared. Try Ctrl+clicking on "prop-types" in import statement - what declaration are you taken to?


This is also happening for me.



I have got the same issue:



There are two folders with prop-types in my node_module
one of them is for my prop-types package 
and one of them is created (automatically) with the name of "@type" in node_modules


i am getting the same ... any solution yet ?


Try changing it to: import * as PropTypes from "prop-types";

Silly but it works!


yes, it's silly to import all from as PropTypes but its work for me.

There isn't a better solution for it? 


I would be interested in a better solution as well...


Maybe creating your own version of PropTypes with all the types by default. A little bit nasty but it should help IDE and your code will still look pretty.


I solved it by removing the package:
`yarn remove @types/prop-types`

And removing the entire folder because it was still in my node_modules:
`rm -r node_modules/@types/prop-types`


Please sign in to leave a comment.