Skip to content

Instantly share code, notes, and snippets.

@zerobias
Created May 21, 2018 00:22
Show Gist options
  • Save zerobias/5143a2ac96d714ea6e5002d201a28631 to your computer and use it in GitHub Desktop.
Save zerobias/5143a2ac96d714ea6e5002d201a28631 to your computer and use it in GitHub Desktop.
//@flow
export type ExtractReturn<Fn> = $Call<<T>((...Iterable<any>) => T) => T, Fn>;
//example
const mapDispatchToProps = (dispatch: Dispatch) => ({
actions: {
setCompany: ({ companyId, domainName }) =>
dispatch(
setCompany({
companyId,
domainName,
}),
),
},
});
type ReduxActions = ExtractReturn<typeof mapDispatchToProps>;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment