Created
June 4, 2020 17:26
-
-
Save webpapaya/0adb802bdac768a25eee9e5f6efb3bd3 to your computer and use it in GitHub Desktop.
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
import { AnyAction } from 'redux' | |
import { ThunkAction, ThunkDispatch } from 'redux-thunk' | |
import { rootReducer } from '.' | |
import createHTTPInstance from '../utils/create-http-connection' | |
export type ExternalDependencies = { | |
http: ReturnType<typeof createHTTPInstance> | |
} | |
export type AppState = ReturnType<typeof rootReducer> | |
export type ActionCreator<Args, ReturnValue, Actions extends AnyAction> = ( | |
arg: Args | |
) => ThunkAction<Promise<ReturnValue>, AppState, ExternalDependencies, Actions> | |
export type MapStateToProps<ReturnValue, OwnPropsType> = | |
(state: AppState, ownProps: OwnPropsType) => ReturnValue; | |
export type MapDispatchToProps<ReturnValue, OwnPropsType> = ( | |
dispatch: ThunkDispatch<AppState, ExternalDependencies, AnyAction>, | |
ownProps: OwnPropsType, | |
) => ReturnValue; | |
export type UnpackThunk<ActionCreator extends (...args: any) => any> = ( | |
...args: Parameters<ActionCreator> | |
) => ReturnType<ReturnType<ActionCreator>>; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment