import { Action } from 'redux'; type ActionWithPayload = Action & P; export function action(type: T): Action; export function action(type: T, payload: P): ActionWithPayload; export function action(type: T, payload?: P) { return { type, ...payload }; } export type GenericActionMapping = { [somekey in keyof A]: (...args: any) => Action | ActionWithPayload }; export type GenericActionTypes> = ReturnType['type']; export type GenericAction> = ReturnType]>; export type GenericActionLookup> = { [a in GenericActionTypes]: ReturnType };