diff --git a/types/react-redux/index.d.ts b/types/react-redux/index.d.ts index 25b3ae2668..8aa723c232 100644 --- a/types/react-redux/index.d.ts +++ b/types/react-redux/index.d.ts @@ -73,9 +73,6 @@ type Shared< // Will not pass through the injected props if they are passed in during // render. Also adds new prop requirements from TNeedsProps. export interface InferableComponentEnhancerWithProps { - ( - component: StatelessComponent - ): ComponentClass & {WrappedComponent: StatelessComponent}

>( component: ComponentType

): ComponentClass> & TNeedsProps> & {WrappedComponent: ComponentType

} diff --git a/types/react-redux/react-redux-tests.tsx b/types/react-redux/react-redux-tests.tsx index f446df9a1e..5d2395d811 100644 --- a/types/react-redux/react-redux-tests.tsx +++ b/types/react-redux/react-redux-tests.tsx @@ -832,7 +832,12 @@ namespace TestDispatchToPropsAsObject {

} -namespace TestInferredFunctionalComponent { +namespace TestInferredFunctionalComponentWithExplicitOwnProps { + type Props = { + title: string, + extraText: string, + onClick: () => void, + }; const Header = connect( ( @@ -845,7 +850,30 @@ namespace TestInferredFunctionalComponent { (dispatch) => ({ onClick: () => dispatch({ type: 'test' }) }) - )(({ title, extraText, onClick }) => { + )(({ title, extraText, onClick }: Props) => { + return

{title} {extraText}

; + }); +
+} + +namespace TestInferredFunctionalComponentWithImplicitOwnProps { + + type Props = { + title: string, + extraText: string, + onClick: () => void, + }; + + const Header = connect( + ( + { app: { title }}: { app: { title: string }}, + ) => ({ + title, + }), + (dispatch) => ({ + onClick: () => dispatch({ type: 'test' }) + }) + )(({ title, extraText, onClick }: Props) => { return

{title} {extraText}

; });
@@ -1126,4 +1154,4 @@ namespace TestFailsMoreSpecificInjectedProps { // Since it is possible the injected props could fail to satisfy the decoration props, // the following line should fail to compile. connect(mapStateToProps, mapDispatchToProps)(Component) // $ExpectError -} \ No newline at end of file +}