import { StoreAction } from 'store'; import { Action } from 'redux'; /** Helper type which is used to convert actionCreator to redux `connect` bound prop */ export type BoundActionCreator = A extends (...args: infer U) => StoreAction ? (...args: U) => R : A extends (...args: infer U) => Action ? (...args: U) => Action : A extends (...args: infer U) => Promise ? (...args: U) => Promise : never; /** Helper type which is used to convert actionCreators map to redux `connect` bound props */ export type BoundActionCreators = { [K in keyof T]: BoundActionCreator }; /** * no-op function that is used for type conversion for action creators connected * through mapDispatchToProps */ export function bindActions(obj: A): BoundActionCreators { // eslint-disable-next-line @typescript-eslint/no-explicit-any return obj as any; }