DEV Community

Discussion on: React PropTypes vs Typescript! Any experience?

Collapse
 
michaeljota profile image
Michael De Abreu

I worked in a project where were used PropTypes and I strongly suggest to migrate to Typescript. I did most of the code migration, and after that I had to left. Sometime after, I ask about the project, and one of my coworkers said to me that they handle to migrate to Typescript, but PropTypes was still a thing for them, I think because they use them in production as well.

  • Typescript: Static type check.
  • PropTypes: Runtime type check.

If you are going to check for type just in development, then Typescript is a better option. Even if you are going to check in production, that you should not for performance reasons, but if you are, still, you would be much better with Typescript, and adding on top PropTypes just for the sake of runtime checking.