mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 12:30:18 +00:00
[react-redux] Make connect input types optional
For convenience.
This commit is contained in:
Vendored
+11
-11
@@ -67,66 +67,66 @@ export type InferableComponentEnhancer<TInjectedProps> =
|
||||
*/
|
||||
export declare function connect(): InferableComponentEnhancer<DispatchProp<any>>;
|
||||
|
||||
export declare function connect<TStateProps, no_dispatch, TOwnProps>(
|
||||
export declare function connect<TStateProps = {}, no_dispatch = {}, TOwnProps = {}>(
|
||||
mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps>
|
||||
): InferableComponentEnhancerWithProps<TStateProps & DispatchProp<any>, TOwnProps>;
|
||||
|
||||
export declare function connect<no_state, TDispatchProps, TOwnProps>(
|
||||
export declare function connect<no_state = {}, TDispatchProps = {}, TOwnProps = {}>(
|
||||
mapStateToProps: null | undefined,
|
||||
mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>
|
||||
): InferableComponentEnhancerWithProps<TDispatchProps, TOwnProps>;
|
||||
|
||||
export declare function connect<TStateProps, TDispatchProps, TOwnProps>(
|
||||
export declare function connect<TStateProps = {}, TDispatchProps = {}, TOwnProps = {}>(
|
||||
mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps>,
|
||||
mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>
|
||||
): InferableComponentEnhancerWithProps<TStateProps & TDispatchProps, TOwnProps>;
|
||||
|
||||
export declare function connect<TStateProps, no_dispatch, TOwnProps, TMergedProps>(
|
||||
export declare function connect<TStateProps = {}, no_dispatch = {}, TOwnProps = {}, TMergedProps = {}>(
|
||||
mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps>,
|
||||
mapDispatchToProps: null | undefined,
|
||||
mergeProps: MergeProps<TStateProps, undefined, TOwnProps, TMergedProps>,
|
||||
): InferableComponentEnhancerWithProps<TMergedProps, TOwnProps>;
|
||||
|
||||
export declare function connect<no_state, TDispatchProps, TOwnProps, TMergedProps>(
|
||||
export declare function connect<no_state = {}, TDispatchProps = {}, TOwnProps = {}, TMergedProps = {}>(
|
||||
mapStateToProps: null | undefined,
|
||||
mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>,
|
||||
mergeProps: MergeProps<undefined, TDispatchProps, TOwnProps, TMergedProps>,
|
||||
): InferableComponentEnhancerWithProps<TMergedProps, TOwnProps>;
|
||||
|
||||
export declare function connect<no_state, no_dispatch, TOwnProps, TMergedProps>(
|
||||
export declare function connect<no_state = {}, no_dispatch = {}, TOwnProps = {}, TMergedProps = {}>(
|
||||
mapStateToProps: null | undefined,
|
||||
mapDispatchToProps: null | undefined,
|
||||
mergeProps: MergeProps<undefined, undefined, TOwnProps, TMergedProps>,
|
||||
): InferableComponentEnhancerWithProps<TMergedProps, TOwnProps>;
|
||||
|
||||
export declare function connect<TStateProps, TDispatchProps, TOwnProps, TMergedProps>(
|
||||
export declare function connect<TStateProps = {}, TDispatchProps = {}, TOwnProps = {}, TMergedProps = {}>(
|
||||
mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps>,
|
||||
mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>,
|
||||
mergeProps: MergeProps<TStateProps, TDispatchProps, TOwnProps, TMergedProps>,
|
||||
): InferableComponentEnhancerWithProps<TMergedProps, TOwnProps>;
|
||||
|
||||
export declare function connect<TStateProps, no_dispatch, TOwnProps>(
|
||||
export declare function connect<TStateProps = {}, no_dispatch = {}, TOwnProps = {}>(
|
||||
mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps>,
|
||||
mapDispatchToProps: null | undefined,
|
||||
mergeProps: null | undefined,
|
||||
options: Options<TStateProps, TOwnProps>
|
||||
): InferableComponentEnhancerWithProps<DispatchProp<any> & TStateProps, TOwnProps>;
|
||||
|
||||
export declare function connect<no_state, TDispatchProps, TOwnProps>(
|
||||
export declare function connect<no_state = {}, TDispatchProps = {}, TOwnProps = {}>(
|
||||
mapStateToProps: null | undefined,
|
||||
mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>,
|
||||
mergeProps: null | undefined,
|
||||
options: Options<no_state, TOwnProps>
|
||||
): InferableComponentEnhancerWithProps<TDispatchProps, TOwnProps>;
|
||||
|
||||
export declare function connect<TStateProps, TDispatchProps, TOwnProps>(
|
||||
export declare function connect<TStateProps = {}, TDispatchProps = {}, TOwnProps = {}>(
|
||||
mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps>,
|
||||
mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>,
|
||||
mergeProps: null | undefined,
|
||||
options: Options<TStateProps, TOwnProps>
|
||||
): InferableComponentEnhancerWithProps<TStateProps & TDispatchProps, TOwnProps>;
|
||||
|
||||
export declare function connect<TStateProps, TDispatchProps, TOwnProps, TMergedProps>(
|
||||
export declare function connect<TStateProps = {}, TDispatchProps = {}, TOwnProps = {}, TMergedProps = {}>(
|
||||
mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps>,
|
||||
mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>,
|
||||
mergeProps: MergeProps<TStateProps, TDispatchProps, TOwnProps, TMergedProps>,
|
||||
|
||||
@@ -57,26 +57,26 @@ interface ICounterDispatchProps {
|
||||
onIncrement: () => void
|
||||
}
|
||||
// with higher order functions
|
||||
connect<ICounterStateProps, ICounterDispatchProps, {}>(
|
||||
connect<ICounterStateProps, ICounterDispatchProps>(
|
||||
() => mapStateToProps,
|
||||
() => mapDispatchToProps
|
||||
)(Counter);
|
||||
// with higher order functions using parameters
|
||||
connect<ICounterStateProps, ICounterDispatchProps, {}>(
|
||||
connect<ICounterStateProps, ICounterDispatchProps>(
|
||||
(initialState: CounterState, ownProps) => mapStateToProps,
|
||||
(dispatch: Dispatch<CounterState>, ownProps) => mapDispatchToProps
|
||||
)(Counter);
|
||||
// only first argument
|
||||
connect<ICounterStateProps, {}, {}>(
|
||||
connect<ICounterStateProps>(
|
||||
() => mapStateToProps
|
||||
)(Counter);
|
||||
// wrap only one argument
|
||||
connect<ICounterStateProps, ICounterDispatchProps, {}>(
|
||||
connect<ICounterStateProps, ICounterDispatchProps>(
|
||||
mapStateToProps,
|
||||
() => mapDispatchToProps
|
||||
)(Counter);
|
||||
// with extra arguments
|
||||
connect<ICounterStateProps, ICounterDispatchProps, {}, ICounterStateProps & ICounterDispatchProps>(
|
||||
connect<ICounterStateProps, ICounterDispatchProps, ICounterStateProps & ICounterDispatchProps>(
|
||||
() => mapStateToProps,
|
||||
() => mapDispatchToProps,
|
||||
(s: ICounterStateProps, d: ICounterDispatchProps) =>
|
||||
|
||||
Reference in New Issue
Block a user