Skip to content

Instantly share code, notes, and snippets.

@asolove
Created April 12, 2016 15:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asolove/8f31c371239a0138493d7f509f9c4b75 to your computer and use it in GitHub Desktop.
Save asolove/8f31c371239a0138493d7f509f9c4b75 to your computer and use it in GitHub Desktop.
Flow not typing pure fns used as React components?
// @flow
import {Component} from 'react';
export class Parent extends Component {
render () {
return <div>
<JustFunction foo={2}/>
<FullComponent foo={2}/>
</div>
}
}
export const JustFunction = ({foo, bar}: {foo: number, bar: number}) => <div>{foo},{bar}</div>;
export class FullComponent extends Component {
props: {foo: number; bar: number};
render() {
return <div>{this.props.foo}, {this.props.bar}</div>;
}
}
// Flow only complaints about FullComponent missing bar.
// Doesn't mention JustFunction also missing bar.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment