From 15e604f2f37524a9bc39e35a61bc6d26696fd31e Mon Sep 17 00:00:00 2001 From: Frank Tan Date: Sun, 27 Aug 2017 16:11:16 -0400 Subject: [PATCH 1/2] [react-redux] Make `connect` input types optional For convenience. --- types/react-redux/index.d.ts | 22 +++++++++++----------- types/react-redux/react-redux-tests.tsx | 10 +++++----- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/types/react-redux/index.d.ts b/types/react-redux/index.d.ts index b83252a745..44c18a91a5 100644 --- a/types/react-redux/index.d.ts +++ b/types/react-redux/index.d.ts @@ -67,66 +67,66 @@ export type InferableComponentEnhancer = */ export declare function connect(): InferableComponentEnhancer>; -export declare function connect( +export declare function connect( mapStateToProps: MapStateToPropsParam ): InferableComponentEnhancerWithProps, TOwnProps>; -export declare function connect( +export declare function connect( mapStateToProps: null | undefined, mapDispatchToProps: MapDispatchToPropsParam ): InferableComponentEnhancerWithProps; -export declare function connect( +export declare function connect( mapStateToProps: MapStateToPropsParam, mapDispatchToProps: MapDispatchToPropsParam ): InferableComponentEnhancerWithProps; -export declare function connect( +export declare function connect( mapStateToProps: MapStateToPropsParam, mapDispatchToProps: null | undefined, mergeProps: MergeProps, ): InferableComponentEnhancerWithProps; -export declare function connect( +export declare function connect( mapStateToProps: null | undefined, mapDispatchToProps: MapDispatchToPropsParam, mergeProps: MergeProps, ): InferableComponentEnhancerWithProps; -export declare function connect( +export declare function connect( mapStateToProps: null | undefined, mapDispatchToProps: null | undefined, mergeProps: MergeProps, ): InferableComponentEnhancerWithProps; -export declare function connect( +export declare function connect( mapStateToProps: MapStateToPropsParam, mapDispatchToProps: MapDispatchToPropsParam, mergeProps: MergeProps, ): InferableComponentEnhancerWithProps; -export declare function connect( +export declare function connect( mapStateToProps: MapStateToPropsParam, mapDispatchToProps: null | undefined, mergeProps: null | undefined, options: Options ): InferableComponentEnhancerWithProps & TStateProps, TOwnProps>; -export declare function connect( +export declare function connect( mapStateToProps: null | undefined, mapDispatchToProps: MapDispatchToPropsParam, mergeProps: null | undefined, options: Options ): InferableComponentEnhancerWithProps; -export declare function connect( +export declare function connect( mapStateToProps: MapStateToPropsParam, mapDispatchToProps: MapDispatchToPropsParam, mergeProps: null | undefined, options: Options ): InferableComponentEnhancerWithProps; -export declare function connect( +export declare function connect( mapStateToProps: MapStateToPropsParam, mapDispatchToProps: MapDispatchToPropsParam, mergeProps: MergeProps, diff --git a/types/react-redux/react-redux-tests.tsx b/types/react-redux/react-redux-tests.tsx index 5a9b038dc5..619a25a7df 100644 --- a/types/react-redux/react-redux-tests.tsx +++ b/types/react-redux/react-redux-tests.tsx @@ -57,26 +57,26 @@ interface ICounterDispatchProps { onIncrement: () => void } // with higher order functions -connect( +connect( () => mapStateToProps, () => mapDispatchToProps )(Counter); // with higher order functions using parameters -connect( +connect( (initialState: CounterState, ownProps) => mapStateToProps, (dispatch: Dispatch, ownProps) => mapDispatchToProps )(Counter); // only first argument -connect( +connect( () => mapStateToProps )(Counter); // wrap only one argument -connect( +connect( mapStateToProps, () => mapDispatchToProps )(Counter); // with extra arguments -connect( +connect( () => mapStateToProps, () => mapDispatchToProps, (s: ICounterStateProps, d: ICounterDispatchProps) => From 5677208b599570119ab8712bee1e2a9765a6b64d Mon Sep 17 00:00:00 2001 From: Frank Tan Date: Tue, 29 Aug 2017 11:28:29 -0400 Subject: [PATCH 2/2] [react-redux] Fix incorrect change in connect. Accidentally removed {} in 3rd generic position and turned this into a 3-arity version vs the original 4-arity. --- types/react-redux/react-redux-tests.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-redux/react-redux-tests.tsx b/types/react-redux/react-redux-tests.tsx index 619a25a7df..e369003434 100644 --- a/types/react-redux/react-redux-tests.tsx +++ b/types/react-redux/react-redux-tests.tsx @@ -76,7 +76,7 @@ connect( () => mapDispatchToProps )(Counter); // with extra arguments -connect( +connect( () => mapStateToProps, () => mapDispatchToProps, (s: ICounterStateProps, d: ICounterDispatchProps) =>