Support flow type props validation
See original GitHub issueDid you have any plan to support:
export default class Item extends React.Component { // eslint-disable-line
props: {
icon: string,
tooltip?: string,
onClick?: () => void,
};
render() {
const { icon, tooltip, onClick } = this.props
return (
<span className={styles.root} onMouseDown={onClick} title={tooltip}>
<span className="material-icons">{icon}</span>
</span>
)
}
}
together with
static propTypes = {
icon: React.PropTypes.string.isRequired,
tooltip: React.PropTypes.string,
onClick: React.PropTypes.func,
};
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Components | Flow
Learn how to type React class components and stateless functional components with Flow.
Read more >How to validate React props using PropTypes - LogRocket Blog
Learn how to validate props with React PropTypes, React's internal mechanism for adding type checking to component props.
Read more >Flow is missing props validation when setting default values ...
The FlowType docs give an example: ES2015 features Default values assigned to parameters must come after the parameter's type annotation:.
Read more >Props missing in props validation when defined as flow types ...
From time to time I'm in the need of sharing my Flow type definitions for my props between different components. To do so,...
Read more >Props | Vue.js
Prop Validation. Components can specify requirements for their props, such as the types you've already seen. If a requirement is not met, Vue...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It seems that info addon still does not render props from flow types though.
@Mottoweb try cleaning out your
node_modules
and reinstalling. You’ll need the latest version of info and the associated babel plugin. It’s working in the example app out of the box.