From d1ed46938b96da4904ececaff3b60254a95fa52d Mon Sep 17 00:00:00 2001 From: Jex <35288649+JexLau@users.noreply.github.com> Date: Sat, 4 Nov 2023 01:35:40 +0800 Subject: [PATCH] type: add generics to AppProps (#45669) * type: add generics to AppProps * type: add generics to rootProps --- components/app/index.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/components/app/index.tsx b/components/app/index.tsx index cb1eb7a98f..f595d0aa95 100644 --- a/components/app/index.tsx +++ b/components/app/index.tsx @@ -2,7 +2,7 @@ import type { ReactNode } from 'react'; import React, { useContext } from 'react'; import classNames from 'classnames'; -import type { CustomComponent } from '../_util/type'; +import type { AnyObject, CustomComponent } from '../_util/type'; import type { ConfigConsumerProps } from '../config-provider'; import { ConfigContext } from '../config-provider'; import useMessage from '../message/useMessage'; @@ -12,18 +12,18 @@ import type { AppConfig, useAppProps } from './context'; import AppContext, { AppConfigContext } from './context'; import useStyle from './style'; -export interface AppProps extends AppConfig { +export interface AppProps

extends AppConfig { style?: React.CSSProperties; className?: string; rootClassName?: string; prefixCls?: string; children?: ReactNode; - component?: false | CustomComponent; + component?: CustomComponent

| false; } const useApp = () => React.useContext(AppContext); -const App: React.FC & { useApp: typeof useApp } = (props) => { +const App: React.FC & { useApp: () => useAppProps } = (props) => { const { prefixCls: customizePrefixCls, children, @@ -66,7 +66,7 @@ const App: React.FC & { useApp: typeof useApp } = (props) => { // ============================ Render ============================ const Component = component === false ? React.Fragment : component; - const rootProps = { + const rootProps: AppProps = { className: customClassName, style, };