{"action":"created","issue":{"url":"https://api.github.com/repos/flowtype/flow-typed/issues/92","repository_url":"https://api.github.com/repos/flowtype/flow-typed","labels_url":"https://api.github.com/repos/flowtype/flow-typed/issues/92/labels{/name}","comments_url":"https://api.github.com/repos/flowtype/flow-typed/issues/92/comments","events_url":"https://api.github.com/repos/flowtype/flow-typed/issues/92/events","html_url":"https://github.com/flowtype/flow-typed/issues/92","id":154600231,"number":92,"title":"[request] react-redux","user":{"login":"bsr203","id":1966521,"avatar_url":"https://avatars.githubusercontent.com/u/1966521?v=3","gravatar_id":"","url":"https://api.github.com/users/bsr203","html_url":"https://github.com/bsr203","followers_url":"https://api.github.com/users/bsr203/followers","following_url":"https://api.github.com/users/bsr203/following{/other_user}","gists_url":"https://api.github.com/users/bsr203/gists{/gist_id}","starred_url":"https://api.github.com/users/bsr203/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bsr203/subscriptions","organizations_url":"https://api.github.com/users/bsr203/orgs","repos_url":"https://api.github.com/users/bsr203/repos","events_url":"https://api.github.com/users/bsr203/events{/privacy}","received_events_url":"https://api.github.com/users/bsr203/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-05-12T23:01:41Z","updated_at":"2016-05-13T01:02:21Z","closed_at":null,"body":"Hello,\r\n\r\nWe have definition for `redux` in this repo, but a proper parameterized definition for [connect](https://github.com/reactjs/react-redux/blob/master/docs/api.md#connectmapstatetoprops-mapdispatchtoprops-mergeprops-options)  would enforce the type in HOC wrapped component.\r\n\r\nthe behavior seems straightforward, but I am not sure how to parameterize `mapStateToProps`, `mapDispatchToProps`, `mergeProps` to maintain the typing.\r\n\r\ncurrently\r\n\r\n```javascript\r\nconst mapDispatchToProps = (dispatch, ownProps) => {\r\n  return {\r\n    onClick: (data: MyType) => {\r\n      dispatch(doSomething(data))\r\n    }\r\n  }\r\n}\r\n``` \r\nwhen using `onClick`, in the wrapped component, I am losing the the parameter information.\r\n\r\n```javascript\r\n const { onClick } = this.props;\r\n  ....\r\n  render() {\r\n     onClick();\r\n     onClick([]);\r\n      onClick({});\r\n       .....\r\n  }\r\n \r\n```\r\n\r\nIf I get help with this one function, I will create a pull request to make it into a proper module.\r\n\r\nthanks,\r\nbsr."},"comment":{"url":"https://api.github.com/repos/flowtype/flow-typed/issues/comments/218926907","html_url":"https://github.com/flowtype/flow-typed/issues/92#issuecomment-218926907","issue_url":"https://api.github.com/repos/flowtype/flow-typed/issues/92","id":218926907,"user":{"login":"bsr203","id":1966521,"avatar_url":"https://avatars.githubusercontent.com/u/1966521?v=3","gravatar_id":"","url":"https://api.github.com/users/bsr203","html_url":"https://github.com/bsr203","followers_url":"https://api.github.com/users/bsr203/followers","following_url":"https://api.github.com/users/bsr203/following{/other_user}","gists_url":"https://api.github.com/users/bsr203/gists{/gist_id}","starred_url":"https://api.github.com/users/bsr203/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bsr203/subscriptions","organizations_url":"https://api.github.com/users/bsr203/orgs","repos_url":"https://api.github.com/users/bsr203/repos","events_url":"https://api.github.com/users/bsr203/events{/privacy}","received_events_url":"https://api.github.com/users/bsr203/received_events","type":"User","site_admin":false},"created_at":"2016-05-13T01:02:21Z","updated_at":"2016-05-13T01:02:21Z","body":"typescript def is here https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/react-redux/react-redux.d.ts\r\n\r\n```\r\n// Type definitions for react-redux 4.4.0\r\n// Project: https://github.com/rackt/react-redux\r\n// Definitions by: Qubo <https://github.com/tkqubo>, Sean Kelley <https://github.com/seansfkelley>\r\n// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped\r\n\r\n/// <reference path=\"../react/react.d.ts\" />\r\n/// <reference path=\"../redux/redux.d.ts\" />\r\n\r\ndeclare module \"react-redux\" {\r\n  import { ComponentClass, Component, StatelessComponent, ReactNode } from 'react';\r\n  import { Store, Dispatch, ActionCreator } from 'redux';\r\n\r\n  interface ComponentDecorator<TOriginalProps, TOwnProps> {\r\n    (component: ComponentClass<TOriginalProps>|StatelessComponent<TOriginalProps>): ComponentClass<TOwnProps>;\r\n  }\r\n\r\n  /**\r\n   * Decorator that infers the type from the original component\r\n   *\r\n   * Can't use the above decorator because it would default the type to {}\r\n   */\r\n  export interface InferableComponentDecorator {\r\n    <P, TComponentConstruct extends (ComponentClass<P>|StatelessComponent<P>)>(component: TComponentConstruct): TComponentConstruct;\r\n  }\r\n\r\n  /**\r\n   * Connects a React component to a Redux store.\r\n   *\r\n   * - Without arguments, just wraps the component, without changing the behavior / props\r\n   *\r\n   * - If 2 params are passed (3rd param, mergeProps, is skipped), default behavior\r\n   * is to override ownProps (as stated in the docs), so what remains is everything that's\r\n   * not a state or dispatch prop\r\n   *\r\n   * - When 3rd param is passed, we don't know if ownProps propagate and whether they\r\n   * should be valid component props, because it depends on mergeProps implementation.\r\n   * As such, it is the user's responsibility to extend ownProps interface from state or\r\n   * dispatch props or both when applicable\r\n   *\r\n   * @param mapStateToProps\r\n   * @param mapDispatchToProps\r\n   * @param mergeProps\r\n   * @param options\r\n   */\r\n  export function connect(): InferableComponentDecorator;\r\n\r\n  export function connect<TStateProps, TDispatchProps, TOwnProps>(\r\n    mapStateToProps: MapStateToProps<TStateProps, TOwnProps>,\r\n    mapDispatchToProps?: MapDispatchToPropsFunction<TDispatchProps, TOwnProps>|MapDispatchToPropsObject\r\n  ): ComponentDecorator<TStateProps & TDispatchProps, TOwnProps>;\r\n\r\n  export function connect<TStateProps, TDispatchProps, TOwnProps>(\r\n    mapStateToProps: MapStateToProps<TStateProps, TOwnProps>,\r\n    mapDispatchToProps: MapDispatchToPropsFunction<TDispatchProps, TOwnProps>|MapDispatchToPropsObject,\r\n    mergeProps: MergeProps<TStateProps, TDispatchProps, TOwnProps>,\r\n    options?: Options\r\n  ): ComponentDecorator<TStateProps & TDispatchProps, TOwnProps>;\r\n\r\n  interface MapStateToProps<TStateProps, TOwnProps> {\r\n    (state: any, ownProps?: TOwnProps): TStateProps;\r\n  }\r\n\r\n  interface MapDispatchToPropsFunction<TDispatchProps, TOwnProps> {\r\n    (dispatch: Dispatch, ownProps?: TOwnProps): TDispatchProps;\r\n  }\r\n\r\n  interface MapDispatchToPropsObject {\r\n    [name: string]: ActionCreator;\r\n  }\r\n\r\n  interface MergeProps<TStateProps, TDispatchProps, TOwnProps> {\r\n    (stateProps: TStateProps, dispatchProps: TDispatchProps, ownProps: TOwnProps): TStateProps & TDispatchProps;\r\n  }\r\n\r\n  interface Options {\r\n    /**\r\n     * If true, implements shouldComponentUpdate and shallowly compares the result of mergeProps,\r\n     * preventing unnecessary updates, assuming that the component is a “pure” component\r\n     * and does not rely on any input or state other than its props and the selected Redux store’s state.\r\n     * Defaults to true.\r\n     * @default true\r\n     */\r\n    pure?: boolean;\r\n    /**\r\n    * If true, stores a ref to the wrapped component instance and makes it available via \r\n    * getWrappedInstance() method. Defaults to false.\r\n    */\r\n    withRef?: boolean;\r\n  }\r\n\r\n  export interface ProviderProps {\r\n    /**\r\n     * The single Redux store in your application.\r\n     */\r\n    store?: Store;\r\n    children?: ReactNode;\r\n  }\r\n\r\n  /**\r\n   * Makes the Redux store available to the connect() calls in the component hierarchy below.\r\n   */\r\n  export class Provider extends Component<ProviderProps, {}> { }\r\n}\r\n```"}}