diff --git a/packages/react/src/reactrouter.tsx b/packages/react/src/reactrouter.tsx index c15fb9d0b191..d52885dffa8d 100644 --- a/packages/react/src/reactrouter.tsx +++ b/packages/react/src/reactrouter.tsx @@ -16,6 +16,7 @@ import { import type { Client, Integration, Span, TransactionSource } from '@sentry/types'; import hoistNonReactStatics from 'hoist-non-react-statics'; import * as React from 'react'; +import type { ReactElement } from 'react'; import type { Action, Location } from './types'; @@ -32,7 +33,7 @@ export type RouteConfig = { [propName: string]: unknown; path?: string | string[]; exact?: boolean; - component?: JSX.Element; + component?: ReactElement; routes?: RouteConfig[]; }; diff --git a/packages/react/src/types.ts b/packages/react/src/types.ts index ffb961bbfe3b..9c81f63cc0d5 100644 --- a/packages/react/src/types.ts +++ b/packages/react/src/types.ts @@ -1,5 +1,6 @@ // Disabling `no-explicit-any` for the whole file as `any` has became common requirement. /* eslint-disable @typescript-eslint/no-explicit-any */ +import type { ReactElement } from 'react'; export type Action = 'PUSH' | 'REPLACE' | 'POP'; @@ -67,7 +68,7 @@ export type UseNavigationType = () => Action; // react-router > 6.0.0 and >= 6.4.2. export type RouteObjectArrayAlias = any; export type RouteMatchAlias = any; -export type CreateRoutesFromChildren = (children: JSX.Element[]) => RouteObjectArrayAlias; +export type CreateRoutesFromChildren = (children: ReactElement[]) => RouteObjectArrayAlias; export type MatchRoutes = ( routes: RouteObjectArrayAlias, location: Location,