diff --git a/react-redux/react-redux.d.ts b/react-redux/react-redux.d.ts index f510767206..9bb8f7d820 100644 --- a/react-redux/react-redux.d.ts +++ b/react-redux/react-redux.d.ts @@ -10,9 +10,8 @@ declare module "react-redux" { import { ComponentClass, Component, StatelessComponent, Props, ReactNode } from 'react'; import { Store, Dispatch, ActionCreator } from 'redux'; - /** Generic decorator, that receives T = original props, U = own props */ - interface ComponentDecorator, U extends Props> { - (component: ComponentClass): ComponentClass; + interface ComponentDecorator, TOwnProps extends Props> { + (component: ComponentClass): ComponentClass; } /** @@ -35,7 +34,7 @@ declare module "react-redux" { * * - When 3rd param is passed, we don't know if ownProps propagate and whether they * should be valid component props, because it depends on mergeProps implementation. - * As such, it is the user's responsability to extend ownProps interface from state or + * As such, it is the user's responsibility to extend ownProps interface from state or * dispatch props or both when applicable * * @param mapStateToProps @@ -44,31 +43,39 @@ declare module "react-redux" { * @param options */ export function connect(): InferableComponentDecorator; - export function connect, U extends Props, V extends Props>( - mapStateToProps: MapStateToProps, - mapDispatchToProps?: MapDispatchToPropsFunction|MapDispatchToPropsObject - ): ComponentDecorator; - export function connect, U extends Props, V extends Props>( - mapStateToProps: MapStateToProps, - mapDispatchToProps: MapDispatchToPropsFunction|MapDispatchToPropsObject, - mergeProps: MergeProps, + export function connect< + TStateProps extends Props, + TDispatchProps extends Props, + TOwnProps extends Props + >( + mapStateToProps: MapStateToProps, + mapDispatchToProps?: MapDispatchToPropsFunction|MapDispatchToPropsObject + ): ComponentDecorator; + export function connect< + TStateProps extends Props, + TDispatchProps extends Props, + TOwnProps extends Props + >( + mapStateToProps: MapStateToProps, + mapDispatchToProps: MapDispatchToPropsFunction|MapDispatchToPropsObject, + mergeProps: MergeProps, options?: Options - ): ComponentDecorator; + ): ComponentDecorator; - interface MapStateToProps { - (state: any, ownProps?: V): T; + interface MapStateToProps { + (state: any, ownProps?: TOwnProps): TStateProps; } - interface MapDispatchToPropsFunction { - (dispatch: Dispatch, ownProps?: V): U; + interface MapDispatchToPropsFunction { + (dispatch: Dispatch, ownProps?: TOwnProps): TDispatchProps; } interface MapDispatchToPropsObject { [name: string]: ActionCreator; } - interface MergeProps { - (stateProps: T, dispatchProps: U, ownProps: V): T & U; + interface MergeProps { + (stateProps: TStateProps, dispatchProps: TDispatchProps, ownProps: TOwnProps): TStateProps & TDispatchProps; } interface Options {