From bb469494f08917782d22d7672d7dcdf5c450c9e4 Mon Sep 17 00:00:00 2001 From: Tasso Evangelista Date: Tue, 2 Jun 2026 22:21:14 -0300 Subject: [PATCH] refactor(ui-client): remove unnecessary ReactElement type annotations from components --- .../src/components/Contextualbar/ContextualbarBack.tsx | 4 ++-- .../src/components/Contextualbar/ContextualbarClose.tsx | 4 ++-- .../Contextualbar/ContextualbarInnerContent.tsx | 4 ++-- .../Contextualbar/ContextualbarSkeletonBody.tsx | 3 +-- .../src/components/CustomScrollbars/CustomScrollbars.tsx | 4 ++-- .../CustomScrollbars/CustomVirtuaScrollbars.tsx | 4 ++-- .../CustomScrollbars/VirtualizedScrollbars.tsx | 2 +- .../components/GenericTable/GenericTableHeaderCell.tsx | 4 ++-- .../components/GenericTable/GenericTableLoadingRow.tsx | 3 +-- .../components/GenericTable/GenericTableLoadingTable.tsx | 4 +--- packages/ui-client/src/components/Header/HeaderIcon.tsx | 2 +- .../src/components/Header/HeaderTag/HeaderTagIcon.tsx | 2 +- .../src/components/InfoPanel/InfoPanelAction.tsx | 4 ++-- .../components/Modal/GenericModal/GenericModal.spec.tsx | 4 ++-- .../src/components/Modal/GenericModal/GenericModal.tsx | 4 ++-- .../components/Modal/GenericModal/withDoNotAskAgain.tsx | 9 +++------ .../ui-client/src/components/Modal/ModalBackdrop.tsx | 4 ++-- .../src/providers/ModalProvider/ModalProvider.spec.tsx | 4 ++-- packages/ui-client/src/providers/TooltipProvider.tsx | 2 +- .../ui-client/src/views/setupWizard/SetupWizardPage.tsx | 4 +--- .../ui-client/src/views/setupWizard/SetupWizardRoute.tsx | 3 +-- .../views/setupWizard/providers/SetupWizardProvider.tsx | 8 ++++++-- .../src/views/setupWizard/steps/AdminInfoStep.tsx | 6 +++--- .../views/setupWizard/steps/CloudAccountConfirmation.tsx | 3 +-- .../src/views/setupWizard/steps/OrganizationInfoStep.tsx | 4 ++-- .../src/views/setupWizard/steps/RegisterServerStep.tsx | 4 ++-- 26 files changed, 48 insertions(+), 55 deletions(-) diff --git a/packages/ui-client/src/components/Contextualbar/ContextualbarBack.tsx b/packages/ui-client/src/components/Contextualbar/ContextualbarBack.tsx index 7c03e574b0e81..16aface5fd83e 100644 --- a/packages/ui-client/src/components/Contextualbar/ContextualbarBack.tsx +++ b/packages/ui-client/src/components/Contextualbar/ContextualbarBack.tsx @@ -1,4 +1,4 @@ -import type { ReactElement, ComponentProps } from 'react'; +import type { ComponentProps } from 'react'; import { memo } from 'react'; import { useTranslation } from 'react-i18next'; @@ -6,7 +6,7 @@ import ContextualbarAction from './ContextualbarAction'; type ContextualbarBackProps = Partial>; -const ContextualbarBack = (props: ContextualbarBackProps): ReactElement => { +const ContextualbarBack = (props: ContextualbarBackProps) => { const { t } = useTranslation(); return ; }; diff --git a/packages/ui-client/src/components/Contextualbar/ContextualbarClose.tsx b/packages/ui-client/src/components/Contextualbar/ContextualbarClose.tsx index 4104a1c28cd72..d06e901424bda 100644 --- a/packages/ui-client/src/components/Contextualbar/ContextualbarClose.tsx +++ b/packages/ui-client/src/components/Contextualbar/ContextualbarClose.tsx @@ -1,4 +1,4 @@ -import type { ComponentProps, ReactElement } from 'react'; +import type { ComponentProps } from 'react'; import { memo } from 'react'; import { useTranslation } from 'react-i18next'; @@ -6,7 +6,7 @@ import ContextualbarAction from './ContextualbarAction'; type ContextualbarCloseProps = Partial>; -const ContextualbarClose = (props: ContextualbarCloseProps): ReactElement => { +const ContextualbarClose = (props: ContextualbarCloseProps) => { const { t } = useTranslation(); return ; }; diff --git a/packages/ui-client/src/components/Contextualbar/ContextualbarInnerContent.tsx b/packages/ui-client/src/components/Contextualbar/ContextualbarInnerContent.tsx index 8612f8197f740..f0ee215ad5305 100644 --- a/packages/ui-client/src/components/Contextualbar/ContextualbarInnerContent.tsx +++ b/packages/ui-client/src/components/Contextualbar/ContextualbarInnerContent.tsx @@ -1,8 +1,8 @@ import { Box } from '@rocket.chat/fuselage'; -import type { ReactElement, ComponentProps } from 'react'; +import type { ComponentProps } from 'react'; import { memo } from 'react'; -const ContextualbarInnerContent = (props: ComponentProps): ReactElement => ( +const ContextualbarInnerContent = (props: ComponentProps) => ( ); diff --git a/packages/ui-client/src/components/Contextualbar/ContextualbarSkeletonBody.tsx b/packages/ui-client/src/components/Contextualbar/ContextualbarSkeletonBody.tsx index 6d0b09552e68c..9c150bc7cbf18 100644 --- a/packages/ui-client/src/components/Contextualbar/ContextualbarSkeletonBody.tsx +++ b/packages/ui-client/src/components/Contextualbar/ContextualbarSkeletonBody.tsx @@ -1,9 +1,8 @@ import { Box, Skeleton } from '@rocket.chat/fuselage'; -import type { ReactElement } from 'react'; import ContextualbarHeader from './ContextualbarHeader'; -const ContextualbarSkeletonBody = (): ReactElement => ( +const ContextualbarSkeletonBody = () => ( <> diff --git a/packages/ui-client/src/components/CustomScrollbars/CustomScrollbars.tsx b/packages/ui-client/src/components/CustomScrollbars/CustomScrollbars.tsx index f2aab56959cd8..36eaec254ed36 100644 --- a/packages/ui-client/src/components/CustomScrollbars/CustomScrollbars.tsx +++ b/packages/ui-client/src/components/CustomScrollbars/CustomScrollbars.tsx @@ -1,12 +1,12 @@ import { useOverlayScrollbars } from 'overlayscrollbars-react'; -import type { HTMLAttributes, ReactElement } from 'react'; +import type { HTMLAttributes, ReactNode } from 'react'; import { useEffect, useRef, forwardRef, memo } from 'react'; import type { OverlayScrollbars } from '.'; import BaseScrollbars, { getScrollbarsOptions } from './BaseScrollbars'; type CustomScrollbarsProps = { - children: ReactElement; + children: ReactNode; overflowX?: boolean; onScroll?: (args: OverlayScrollbars) => void; } & Omit, 'is' | 'onScroll'>; diff --git a/packages/ui-client/src/components/CustomScrollbars/CustomVirtuaScrollbars.tsx b/packages/ui-client/src/components/CustomScrollbars/CustomVirtuaScrollbars.tsx index 72bb5d9fc5ef2..4e257d5cd24d1 100644 --- a/packages/ui-client/src/components/CustomScrollbars/CustomVirtuaScrollbars.tsx +++ b/packages/ui-client/src/components/CustomScrollbars/CustomVirtuaScrollbars.tsx @@ -1,11 +1,11 @@ import { useOverlayScrollbars } from 'overlayscrollbars-react'; -import type { HTMLAttributes, ReactElement } from 'react'; +import type { HTMLAttributes, ReactNode } from 'react'; import { useEffect, memo, forwardRef, useRef } from 'react'; import BaseScrollbars from './BaseScrollbars'; type CustomScrollbarsProps = { - children: ReactElement; + children: ReactNode; } & Omit, 'is' | 'onScroll'>; const CustomVirtuaScrollbars = forwardRef(function CustomScrollbars({ ...props }, ref) { diff --git a/packages/ui-client/src/components/CustomScrollbars/VirtualizedScrollbars.tsx b/packages/ui-client/src/components/CustomScrollbars/VirtualizedScrollbars.tsx index 2ddde3b87c13c..7b0cfada94c85 100644 --- a/packages/ui-client/src/components/CustomScrollbars/VirtualizedScrollbars.tsx +++ b/packages/ui-client/src/components/CustomScrollbars/VirtualizedScrollbars.tsx @@ -6,7 +6,7 @@ import BaseScrollbars, { getScrollbarsOptions } from './BaseScrollbars'; type VirtualizedScrollbarsProps = { overflowX?: boolean; - children: ReactElement; + children: ReactElement; } & Omit, 'is'>; const VirtualizedScrollbars = forwardRef(function VirtualizedScrollbars( diff --git a/packages/ui-client/src/components/GenericTable/GenericTableHeaderCell.tsx b/packages/ui-client/src/components/GenericTable/GenericTableHeaderCell.tsx index bf66b69f513bf..e74ba87edc36a 100644 --- a/packages/ui-client/src/components/GenericTable/GenericTableHeaderCell.tsx +++ b/packages/ui-client/src/components/GenericTable/GenericTableHeaderCell.tsx @@ -1,5 +1,5 @@ import { Box, TableCell } from '@rocket.chat/fuselage'; -import type { ComponentProps, ReactElement } from 'react'; +import type { ComponentProps } from 'react'; import { useCallback } from 'react'; import SortIcon from './SortIcon'; @@ -18,7 +18,7 @@ export const GenericTableHeaderCell = ({ sort, onClick, ...props -}: GenericTableHeaderCellProps): ReactElement => { +}: GenericTableHeaderCellProps) => { const fn = useCallback(() => onClick && sort && onClick(sort), [sort, onClick]); return ( diff --git a/packages/ui-client/src/components/GenericTable/GenericTableLoadingRow.tsx b/packages/ui-client/src/components/GenericTable/GenericTableLoadingRow.tsx index e544fba33ed08..6642261115b61 100644 --- a/packages/ui-client/src/components/GenericTable/GenericTableLoadingRow.tsx +++ b/packages/ui-client/src/components/GenericTable/GenericTableLoadingRow.tsx @@ -1,7 +1,6 @@ import { Box, Skeleton, TableRow, TableCell } from '@rocket.chat/fuselage'; -import type { ReactElement } from 'react'; -export const GenericTableLoadingRow = ({ cols }: { cols: number }): ReactElement => ( +export const GenericTableLoadingRow = ({ cols }: { cols: number }) => ( diff --git a/packages/ui-client/src/components/GenericTable/GenericTableLoadingTable.tsx b/packages/ui-client/src/components/GenericTable/GenericTableLoadingTable.tsx index 6155090f5d5fc..55af6b268938d 100644 --- a/packages/ui-client/src/components/GenericTable/GenericTableLoadingTable.tsx +++ b/packages/ui-client/src/components/GenericTable/GenericTableLoadingTable.tsx @@ -1,8 +1,6 @@ -import type { ReactElement } from 'react'; - import { GenericTableLoadingRow } from './GenericTableLoadingRow'; -export const GenericTableLoadingTable = ({ headerCells }: { headerCells: number }): ReactElement => ( +export const GenericTableLoadingTable = ({ headerCells }: { headerCells: number }) => ( <> {Array.from({ length: 10 }, (_, i) => ( diff --git a/packages/ui-client/src/components/Header/HeaderIcon.tsx b/packages/ui-client/src/components/Header/HeaderIcon.tsx index 9175b66257d32..767ee621027d1 100644 --- a/packages/ui-client/src/components/Header/HeaderIcon.tsx +++ b/packages/ui-client/src/components/Header/HeaderIcon.tsx @@ -2,7 +2,7 @@ import { Box, Icon } from '@rocket.chat/fuselage'; import type { ComponentPropsWithoutRef, ReactElement } from 'react'; import { isValidElement } from 'react'; -type HeaderIconProps = { icon: ReactElement | ComponentPropsWithoutRef | null }; +type HeaderIconProps = { icon: ReactElement | ComponentPropsWithoutRef | null }; const HeaderIcon = ({ icon }: HeaderIconProps) => icon && ( diff --git a/packages/ui-client/src/components/Header/HeaderTag/HeaderTagIcon.tsx b/packages/ui-client/src/components/Header/HeaderTag/HeaderTagIcon.tsx index 3f46570719498..262c3df71b864 100644 --- a/packages/ui-client/src/components/Header/HeaderTag/HeaderTagIcon.tsx +++ b/packages/ui-client/src/components/Header/HeaderTag/HeaderTagIcon.tsx @@ -3,7 +3,7 @@ import type { ComponentPropsWithoutRef, ReactElement } from 'react'; import { isValidElement } from 'react'; type HeaderIconProps = { - icon: ReactElement | Pick, 'name' | 'color'> | null; + icon: ReactElement | Pick, 'name' | 'color'> | null; }; const HeaderTagIcon = ({ icon }: HeaderIconProps) => { diff --git a/packages/ui-client/src/components/InfoPanel/InfoPanelAction.tsx b/packages/ui-client/src/components/InfoPanel/InfoPanelAction.tsx index 0959c70df1f32..34c4d5a4802e8 100644 --- a/packages/ui-client/src/components/InfoPanel/InfoPanelAction.tsx +++ b/packages/ui-client/src/components/InfoPanel/InfoPanelAction.tsx @@ -1,13 +1,13 @@ import { Button } from '@rocket.chat/fuselage'; import type { Keys as IconName } from '@rocket.chat/icons'; -import type { ComponentProps, ReactElement, ReactNode } from 'react'; +import type { ComponentProps, ReactNode } from 'react'; type InfoPanelActionProps = Omit, 'label'> & { icon?: IconName; label: ReactNode; }; -const InfoPanelAction = ({ label, icon, ...props }: InfoPanelActionProps): ReactElement => ( +const InfoPanelAction = ({ label, icon, ...props }: InfoPanelActionProps) => (