Skip to content

Commit

Permalink
fix(design): ConfigProvider TS error
Browse files Browse the repository at this point in the history
  • Loading branch information
dengfuping committed Jan 27, 2024
1 parent 73062d7 commit 1e1477e
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions packages/design/src/config-provider/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,16 @@ const ExtendedConfigContext = React.createContext<ExtendedConfigConsumerProps>({

const { defaultSeed } = themeConfig;

const ConfigProvider = ({
export type ConfigProviderType = React.FC<ConfigProviderProps> & {
ExtendedConfigContext: typeof ExtendedConfigContext;
} & {
ConfigContext: React.Context<ConfigConsumerProps>;
SizeContext: typeof AntConfigProvider.SizeContext;
config: typeof AntConfigProvider.config;
useConfig: typeof AntConfigProvider.useConfig;
};

const ConfigProvider: ConfigProviderType = ({
children,
theme,
navigate,
Expand All @@ -82,7 +91,7 @@ const ConfigProvider = ({
tabs,
styleProviderProps,
...restProps
}: ConfigProviderProps) => {
}) => {
// inherit from parent ConfigProvider
const parentContext = React.useContext<ConfigConsumerProps>(AntConfigProvider.ConfigContext);
const parentExtendedContext =
Expand Down Expand Up @@ -140,8 +149,7 @@ const ConfigProvider = ({
);
};

ConfigProvider.ConfigContext =
AntConfigProvider.ConfigContext as React.Context<ConfigConsumerProps>;
ConfigProvider.ConfigContext = AntConfigProvider.ConfigContext;
ConfigProvider.ExtendedConfigContext = ExtendedConfigContext;
ConfigProvider.SizeContext = AntConfigProvider.SizeContext;
ConfigProvider.config = AntConfigProvider.config;
Expand Down

0 comments on commit 1e1477e

Please sign in to comment.