diff --git a/types/react-redux/index.d.ts b/types/react-redux/index.d.ts index 1f300e02a6..dc85bc86eb 100644 --- a/types/react-redux/index.d.ts +++ b/types/react-redux/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for react-redux 4.4.0 // Project: https://github.com/rackt/react-redux -// Definitions by: Qubo , Sean Kelley +// Definitions by: Qubo , Sean Kelley , Thomas Hasner // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 @@ -9,13 +9,14 @@ import * as Redux from 'redux'; type ComponentClass

= React.ComponentClass

; type StatelessComponent

= React.StatelessComponent

; +type Component

= ComponentClass

| StatelessComponent

; type ReactNode = React.ReactNode; type Store = Redux.Store; type Dispatch = Redux.Dispatch; type ActionCreator = Redux.ActionCreator; -interface ComponentDecorator { - (component: ComponentClass | StatelessComponent): ComponentClass; +interface ComponentDecorator { + (component: Component): ComponentClass; } /** @@ -23,8 +24,8 @@ interface ComponentDecorator { * * Can't use the above decorator because it would default the type to {} */ -export interface InferableComponentDecorator { - | StatelessComponent

)>(component: TComponentConstruct): TComponentConstruct; +export interface InferableComponentDecorator { + >(component: T): T; } /** @@ -46,14 +47,14 @@ export interface InferableComponentDecorator { * @param mergeProps * @param options */ -export declare function connect(): InferableComponentDecorator; +export declare function connect(): InferableComponentDecorator; export declare function connect( mapStateToProps?: MapStateToProps | MapStateToPropsFactory, mapDispatchToProps?: MapDispatchToProps | MapDispatchToPropsFactory, mergeProps?: MergeProps, options?: Options -): ComponentDecorator; +): ComponentDecorator; interface MapStateToProps { (state: any, ownProps?: TOwnProps): TStateProps; @@ -92,9 +93,9 @@ interface Options { */ pure?: boolean; /** - * If true, stores a ref to the wrapped component instance and makes it available via - * getWrappedInstance() method. Defaults to false. - */ + * If true, stores a ref to the wrapped component instance and makes it available via + * getWrappedInstance() method. Defaults to false. + */ withRef?: boolean; } diff --git a/types/react-redux/react-redux-tests.tsx b/types/react-redux/react-redux-tests.tsx index 4c7a55ea7b..2456f2a379 100644 --- a/types/react-redux/react-redux-tests.tsx +++ b/types/react-redux/react-redux-tests.tsx @@ -343,7 +343,7 @@ namespace TestTOwnPropsInference { state: string; } - class OwnPropsComponent extends React.Component { + class OwnPropsComponent extends React.Component { render() { return