import { ComponentType } from 'react';
// import { Action } from '@lib/types';
import { ActionCreator, bindActionCreators } from 'redux';
import { connect } from 'react-redux';

export default function stateMapper(component: ComponentType<any>, actionCreators: Record<string, ActionCreator<any>>) {
	const mapStateToProps = state => state;
	const mapDispatchToProps = dispatch => bindActionCreators(actionCreators, dispatch);

	return connect(mapStateToProps, mapDispatchToProps)(component) as typeof component;
}
