Created
June 21, 2017 00:56
-
-
Save rsolomon/397292b51fff7a66f8ff23a4afa91a60 to your computer and use it in GitHub Desktop.
react-redux.flow.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** @flow */ | |
import type { Dispatch, Store } from 'redux'; | |
declare module 'react-redux' { | |
/* | |
S = State | |
A = Action | |
AS = AppState | |
OP = OwnProps | |
SP = StateProps | |
DP = DispatchProps | |
MP = MergedProps | |
CP = CombinedProps | |
*/ | |
declare type MapStateToProps<S, OP, SP> = ( | |
state: S, | |
ownProps: OP, | |
) => SP; | |
declare type MapDispatchToProps<A, OP, DP> = ( | |
dispatch: Dispatch<A>, | |
ownProps: OP, | |
) => DP; | |
declare type MergeProps<SP, DP, OP, P> = (stateProps: SP, dispatchProps: DP, ownProps: OP) => P; | |
declare type SinglePropsConnector<D, P, S, SP> = ( | |
component: Class<React$Component<D, P, S>>, | |
) => Class<React$Component<D, $Diff<P, SP>, S>> | |
declare type DoublePropsConnector<D, P, S, SP1, SP2> = ( | |
component: Class<React$Component<D, P, S>>, | |
) => Class<React$Component<D, $Diff<$Diff<P, SP1>, SP2>, S>> | |
declare class Provider<AS, A> | |
extends React$Component<void, { store: Store<AS, A>, children?: any }, void> { } | |
declare type ConnectOptions = { | |
pure?: boolean, | |
withRef?: boolean, | |
}; | |
declare type Null = null | void; | |
declare function connect<A, AS, OP, SP, D, S, CS>( | |
mapStateToProps: MapStateToProps<AS, OP, SP>, | |
mapDispatchToProps: Null, | |
mergeProps: Null, | |
options?: ConnectOptions | |
): DoublePropsConnector<D, CS, S, SP, { dispatch: Dispatch<A> }>; | |
declare function connect<A, OP, CS, DP, D, S>( | |
mapStateToProps: Null, | |
mapDispatchToProps: MapDispatchToProps<A, OP, DP>, | |
mergeProps: Null, | |
options?: ConnectOptions | |
): SinglePropsConnector<D, CS, S, DP>; | |
declare function connect<A, AS, OP, SP, DP, D, S, CS>( | |
mapStateToProps: MapStateToProps<AS, OP, SP>, | |
mapDispatchToProps: MapDispatchToProps<A, OP, DP>, | |
mergeProps: Null, | |
options?: ConnectOptions | |
): DoublePropsConnector<D, CS, S, SP, DP>; | |
declare function connect<A, AS, OP, SP, DP, MP, D, S, CS>( | |
mapStateToProps: MapStateToProps<AS, OP, SP>, | |
mapDispatchToProps: MapDispatchToProps<A, OP, DP>, | |
mergeProps: MergeProps<SP, DP, OP, MP>, | |
options?: ConnectOptions | |
): SinglePropsConnector<D, CS, S, MP>; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment