Skip to content

Instantly share code, notes, and snippets.

@brianlovin
Last active October 29, 2019 20:04
Show Gist options
  • Save brianlovin/22be29883d4a40993b11c87c568eb04b to your computer and use it in GitHub Desktop.
Save brianlovin/22be29883d4a40993b11c87c568eb04b to your computer and use it in GitHub Desktop.
Flow type function prop
// component
type AnotherType = {
data: {
id: string
}
}
type Props = {
aFunction: ({ id: string }) => AnotherType
}
class Foo extends React.Component<Props> {
doAThing = () => {
// this does not trigger a flow error
return this.props.aFunction('blahblah')
}
...
}
@bslipek
Copy link

bslipek commented Sep 7, 2018

aFunction: ({| id: string |}) => AnotherType 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment