-
Notifications
You must be signed in to change notification settings - Fork 1
/
connect.ts
26 lines (20 loc) · 1.24 KB
/
connect.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { StoreState } from './types';
import * as React from 'react';
import {
connect as originalConnect, MapDispatchToPropsParam, MapStateToPropsParam, MergeProps, Options
} from 'react-redux';
export type InferableComponentEnhancerWithProps<TInjectedProps, TNeedsProps> =
<TComponent extends React.ComponentType<TInjectedProps & TNeedsProps>>(component: TComponent) => TComponent;
interface MyConnect {
<TStateProps = {}, TDispatchProps = {}, TOwnProps = {}>(
mapStateToProps?: MapStateToPropsParam<TStateProps, TOwnProps, StoreState>,
mapDispatchToProps?: MapDispatchToPropsParam<TDispatchProps, TOwnProps>
): InferableComponentEnhancerWithProps<TStateProps & TDispatchProps, TOwnProps>;
<TStateProps = {}, TDispatchProps = {}, TOwnProps = {}, TMergedProps = {}>(
mapStateToProps?: MapStateToPropsParam<TStateProps, TOwnProps, StoreState>,
mapDispatchToProps?: MapDispatchToPropsParam<TDispatchProps, TOwnProps>,
mergeProps?: MergeProps<TStateProps, TDispatchProps, TOwnProps, TMergedProps>,
options?: Options<TStateProps, TOwnProps, TMergedProps>
): InferableComponentEnhancerWithProps<TMergedProps, TOwnProps>;
}
export const connect = originalConnect as MyConnect;