question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support flow type props validation

See original GitHub issue

Did 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:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
Mottowebcommented, Aug 17, 2017

It seems that info addon still does not render props from flow types though.

1reaction
danielduancommented, Aug 20, 2017

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found