milesj / babel-plugin-typescript-to-proptypes

Generate React PropTypes from TypeScript interfaces or type aliases.
MIT License
367 stars 25 forks source link

example shows @babel/preset-react, should be '@babel/plugin-syntax-jsx' #20

Closed shcarrico closed 5 years ago

shcarrico commented 5 years ago

The example instructions specify using @babel/preset-react. To produce the transform you are showing in the readme, I think it should be suggesting use of @babel/plugin-syntax-jsx instead.. Using preset react transforms your JSX into JS.

Perhaps I am wrong but, but i had much more luck with the below.

module.exports= {
  presets: ['@babel/preset-typescript'],
  plugins: ['@babel/plugin-syntax-jsx',['babel-plugin-typescript-to-proptypes', { typeCheck: true }]]
}
milesj commented 5 years ago

I use the react preset myself without issue. However, I'll add a note of this to the readme.