Skip to content

Commit dd73188

Browse files
committed
chore: use React.ReactElement instead of JSX.Element
1 parent 04e2f4f commit dd73188

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/loading/Loading.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ const Loading: React.FC<LoadingProps> = (props) => {
120120
let renderIndicator = themeMap[theme];
121121

122122
if (indicator && typeof indicator !== 'boolean') {
123-
renderIndicator = indicator as React.JSX.Element;
123+
renderIndicator = indicator as React.ReactElement;
124124
}
125125
return (
126126
<>

src/tabs/Tabs.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import Sticky from '../sticky';
55
import Badge from '../badge';
66
import { TdTabPanelProps, TdTabsProps } from './type';
77
import TabPanel from './TabPanel';
8+
import type { TabPanelProps } from './TabPanel';
89
import useConfig from '../hooks/useConfig';
910
import { usePrefixClass } from '../hooks/useClass';
1011
import useDefaultProps from '../hooks/useDefaultProps';
@@ -43,15 +44,15 @@ const Tabs: FC<TabsProps> = (props) => {
4344
[size, tabsClass],
4445
);
4546

46-
const itemProps = useMemo<Array<TdTabPanelProps>>(() => {
47+
const itemProps = useMemo<Array<TabPanelProps>>(() => {
4748
if (list && list.length > 0) {
4849
return list;
4950
}
5051

5152
const propsArr = [];
5253

53-
React.Children.forEach(children, (child: React.JSX.Element) => {
54-
if (child.type.displayName === TabPanel.displayName) {
54+
React.Children.forEach(children, (child: React.ReactElement<TabPanelProps>) => {
55+
if ((child.type as any).displayName === TabPanel.displayName) {
5556
propsArr.push(child.props);
5657
}
5758
});

0 commit comments

Comments
 (0)