I'm trying to port my project from JavaScript to TypeScript. I have a higher-order higher-order component called hoistStatics
, which can take in a HOC and hoist the statics of the wrapped component
import hoistNonReactStatics from 'hoist-non-react-statics';
export const hoistStatics = higherOrderComponent => BaseComponent => {
const NewComponent = higherOrderComponent(BaseComponent);
hoistNonReactStatics(NewComponent, BaseComponent);
return NewComponent;
};
My problem, is I have no idea how to type this. Is there a way to type a generic higher-order component? How would I have to deal with props in this case?