From d08baeefe8c83973f341e3eaf301c809c48bc6bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B9=A4=E4=BB=99?= Date: Tue, 23 Aug 2022 11:03:28 +0800 Subject: [PATCH 1/2] fix(ConfigProvider): type --- types/config-provider/index.d.ts | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/types/config-provider/index.d.ts b/types/config-provider/index.d.ts index ba71fc5070..97a83abf0f 100644 --- a/types/config-provider/index.d.ts +++ b/types/config-provider/index.d.ts @@ -20,10 +20,12 @@ export interface ConfigProviderProps { * fallbackUI `Function(error?: {}, errorInfo?: {}) => Element` 捕获错误后的展示 * afterCatch `Function(error?: {}, errorInfo?: {})` 捕获错误后的行为, 比如埋点上传 */ - errorBoundary?: boolean | { - afterCatch?: (error: Error, errorInfo: React.ErrorInfo) => void; - fallbackUI?: (error: Error, errorInfo: React.ErrorInfo) => React.ReactElement; - }; + errorBoundary?: + | boolean + | { + afterCatch?: (error: Error, errorInfo: React.ErrorInfo) => void; + fallbackUI?: (error: Error, errorInfo: React.ErrorInfo) => React.ReactElement; + }; /** * 是否开启 Pure Render 模式,会提高性能,但是也会带来副作用 @@ -52,12 +54,13 @@ export interface ConfigProviderProps { * 弹层挂载的容器节点 */ popupContainer?: string | HTMLElement | ((target: HTMLElement) => HTMLElement); + /** + * 组件 API 的默认配置 + */ + defaultPropsConfig: Record; } -export default class ConfigProvider extends React.Component< - ConfigProviderProps, - any -> { +export default class ConfigProvider extends React.Component { static config(Component: any, options?: any): any; static getContextProps(props: {}, displayName: string): any; static initLocales(locales: any): any; From 855c5925e6f9b8a7e963580dce6ad4513d5ccae5 Mon Sep 17 00:00:00 2001 From: Guo Yunhe Date: Thu, 25 Aug 2022 13:59:51 +0800 Subject: [PATCH 2/2] Update index.d.ts --- types/config-provider/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/config-provider/index.d.ts b/types/config-provider/index.d.ts index 97a83abf0f..fd16999f0d 100644 --- a/types/config-provider/index.d.ts +++ b/types/config-provider/index.d.ts @@ -57,7 +57,7 @@ export interface ConfigProviderProps { /** * 组件 API 的默认配置 */ - defaultPropsConfig: Record; + defaultPropsConfig?: Record; } export default class ConfigProvider extends React.Component {