Open simonguo opened 6 years ago
in
import PropTypes from 'prop-types'; import React from 'react'; const propTypes={ children: PropTypes.node, className: PropTypes.string } function Example() { return <div />; } Example.propTypes = propTypes; export default Example;
out
import PropTypes from 'prop-types'; import React from 'react'; const propTypes = { children: PropTypes.node, className: PropTypes.string }; function Example() { return <div />; } Example.handledProps = []; Example.propTypes = propTypes; export default Example;
https://github.com/simonguo/babel-plugin-transform-react-flow-handled-props/blob/6285a377f8c281d6ba56eae6812f581408187ee9/src/visitors/propVisitor.js#L67
It will be awesome to get PR that adds this functionality 👍 BTW, there is an easier way to get bindings 😸
@layershifter Thank you so much, I will take a closer look at the babel Document!
babel
in
out