0

Before moving to Typescript I was using react-proptypes-generate extension for VS Code, this saved me ton of time, it is so time-consuming to type props manually by hand, to make matters worse if you are using external libraries finding correct types is also time-consuming.

Is there any way to automate generation of typescript types for props in Typescript (at least partially) or to infer them automatically?

Edit :

To be clear, I am not trying to migrate from prop types to typescript, I have already removed the old proptypes from the code when moving to TS, what I want is way to auto generate typescript types for props?

danronmoon
  • 3,814
  • 5
  • 34
  • 56
user158
  • 12,852
  • 7
  • 62
  • 94
  • Maybe you can combine that with Prince Kumar's answer here: https://stackoverflow.com/questions/41746028/proptypes-in-a-typescript-react-application#:~:text=Typescript%20and%20PropTypes%20serve%20different,autocomplete%20for%20function%20calls%2C%20etc. – Rami16 Oct 19 '22 at 13:20
  • Does this answer your question? [PropTypes in a TypeScript React Application](https://stackoverflow.com/questions/41746028/proptypes-in-a-typescript-react-application) – Rami16 Oct 19 '22 at 13:21
  • @Rami16 sorry for the confusion, I am not trying to migrate existing prop types to ts, but to generate typescript types for props? I updated the question to be more clear. Most annoying problem with manually typing types is using external libraries like MUI, there are so much complex types wrapping one another. – user158 Oct 19 '22 at 14:21

0 Answers0