Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ConfigProvider): type defaultPropsConfig #4060

Merged
merged 2 commits into from
Aug 25, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions types/config-provider/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<any>;
};
errorBoundary?:
| boolean
| {
afterCatch?: (error: Error, errorInfo: React.ErrorInfo) => void;
fallbackUI?: (error: Error, errorInfo: React.ErrorInfo) => React.ReactElement<any>;
};

/**
* 是否开启 Pure Render 模式,会提高性能,但是也会带来副作用
Expand Down Expand Up @@ -52,12 +54,13 @@ export interface ConfigProviderProps {
* 弹层挂载的容器节点
*/
popupContainer?: string | HTMLElement | ((target: HTMLElement) => HTMLElement);
/**
* 组件 API 的默认配置
*/
defaultPropsConfig?: Record<string, any>;
}

export default class ConfigProvider extends React.Component<
ConfigProviderProps,
any
> {
export default class ConfigProvider extends React.Component<ConfigProviderProps, any> {
static config(Component: any, options?: any): any;
static getContextProps(props: {}, displayName: string): any;
static initLocales(locales: any): any;
Expand Down