diff --git a/packages/design/src/config-provider/index.tsx b/packages/design/src/config-provider/index.tsx index f19ed712d..d82d29f48 100644 --- a/packages/design/src/config-provider/index.tsx +++ b/packages/design/src/config-provider/index.tsx @@ -72,7 +72,16 @@ const ExtendedConfigContext = React.createContext({ const { defaultSeed } = themeConfig; -const ConfigProvider = ({ +export type ConfigProviderType = React.FC & { + ExtendedConfigContext: typeof ExtendedConfigContext; +} & { + ConfigContext: React.Context; + SizeContext: typeof AntConfigProvider.SizeContext; + config: typeof AntConfigProvider.config; + useConfig: typeof AntConfigProvider.useConfig; +}; + +const ConfigProvider: ConfigProviderType = ({ children, theme, navigate, @@ -82,7 +91,7 @@ const ConfigProvider = ({ tabs, styleProviderProps, ...restProps -}: ConfigProviderProps) => { +}) => { // inherit from parent ConfigProvider const parentContext = React.useContext(AntConfigProvider.ConfigContext); const parentExtendedContext = @@ -140,8 +149,7 @@ const ConfigProvider = ({ ); }; -ConfigProvider.ConfigContext = - AntConfigProvider.ConfigContext as React.Context; +ConfigProvider.ConfigContext = AntConfigProvider.ConfigContext; ConfigProvider.ExtendedConfigContext = ExtendedConfigContext; ConfigProvider.SizeContext = AntConfigProvider.SizeContext; ConfigProvider.config = AntConfigProvider.config;