import React from "react"; import { useConfig } from "./use-config"; import { Config } from "../../configprovider/ConfigContext"; export interface WithConfigProps { /** * @ignore */ config?: Config; } export function withConfig>( WrappedComponent: C ): C { return (React.forwardRef( (props, ref: React.LegacyRef>) => { const config = useConfig(); return React.createElement(WrappedComponent, { ...props, ref, config }); } ) as any) as C; }