Created
April 12, 2016 15:18
-
-
Save asolove/8f31c371239a0138493d7f509f9c4b75 to your computer and use it in GitHub Desktop.
Flow not typing pure fns used as React components?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @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