mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Merge pull request #19378 from tansongyang/master
[react-redux] Give `connect` default types
This commit is contained in:
commit
a7dcec2bb2
22
types/react-redux/index.d.ts
vendored
22
types/react-redux/index.d.ts
vendored
@ -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,21 +57,21 @@ 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);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user