Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save webpapaya/0adb802bdac768a25eee9e5f6efb3bd3 to your computer and use it in GitHub Desktop.
Save webpapaya/0adb802bdac768a25eee9e5f6efb3bd3 to your computer and use it in GitHub Desktop.
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