This VSCode extension allows for easy use of PropType Converter for converting PropTypes to TypeScript types.
- Provides a refactor option for JS/TS files to convert PropType implementations to TypeScript Types.
- Includes the ability to refactor
defaultProps
to a destructured parameter with default values. - Also provides two general convert commands which will convert all the components in a file as well as specific code actions.
While editing a React component, you can either use the "Refactor..." command/menu item, the code actions shortcut, or the "Convert PropTypes..." commands.
The refactor/code actions options will only show up if PropTypes are detected. Additionally, they will rename the file to its appropriate TS file extension.
The PropType Converter library is purposefully limited in what it can convert. You can make recommendations
for common PropTypes to support there. Also it will convert PropTypes it does not understand to unknown
so you can type it correctly!