import type { ComponentType, FunctionComponent } from 'react'; import React from 'react'; import { connect } from 'react-redux'; import { PhoneContext } from './phoneContext'; export type connectModuleProps = (props: T) => any; function connectModule(fn: connectModuleProps) { return (Comp: ComponentType) => { const WithModule = connect( (_, props: any) => fn(props.phone).getUIProps(props), (_, props: any) => fn(props.phone).getUIFunctions(props), )(Comp); return ((props: K) => ( {(phone) => } )) as any as FunctionComponent; }; } export default connectModule;