Skip to content

Commit 1f1aaad

Browse files
committed
JSX type
1 parent 6ca6d1a commit 1f1aaad

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

packages/react/src/reactrouter.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export type RouteConfig = {
3232
[propName: string]: unknown;
3333
path?: string | string[];
3434
exact?: boolean;
35-
component?: JSX.Element;
35+
component?: React.JSX.Element;
3636
routes?: RouteConfig[];
3737
};
3838

@@ -245,7 +245,6 @@ export function withSentryRouting<P extends Record<string, any>, R extends React
245245

246246
WrappedRoute.displayName = `sentryRoute(${componentDisplayName})`;
247247
// Need to set type to any because of hoist-non-react-statics typing
248-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
249248
hoistNonReactStatics(WrappedRoute, Route as any);
250249
// @ts-expect-error Setting more specific React Component typing for `R` generic above
251250
// will break advanced type inference done by react router params:

packages/react/src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Disabling `no-explicit-any` for the whole file as `any` has became common requirement.
22
/* eslint-disable @typescript-eslint/no-explicit-any */
3+
import type { JSX } from 'react';
34

45
export type Action = 'PUSH' | 'REPLACE' | 'POP';
56

packages/react/test/errorboundary.test.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@ jest.mock('@sentry/browser', () => {
2626
};
2727
});
2828

29-
function Boo({ title }: { title: string }): JSX.Element {
29+
function Boo({ title }: { title: string }): React.JSX.Element {
3030
throw new Error(title);
3131
}
3232

33-
function Bam(): JSX.Element {
33+
function Bam(): React.JSX.Element {
3434
const [title] = useState('boom');
3535
return <Boo title={title} />;
3636
}
3737

38-
function EffectSpyFallback({ error }: { error: unknown }): JSX.Element {
38+
function EffectSpyFallback({ error }: { error: unknown }): React.JSX.Element {
3939
const [counter, setCounter] = useState(0);
4040

4141
React.useEffect(() => {
@@ -50,7 +50,7 @@ function EffectSpyFallback({ error }: { error: unknown }): JSX.Element {
5050
}
5151

5252
interface TestAppProps extends ErrorBoundaryProps {
53-
errorComp?: JSX.Element;
53+
errorComp?: React.JSX.Element;
5454
}
5555

5656
const TestApp: React.FC<TestAppProps> = ({ children, errorComp, ...props }) => {
@@ -282,7 +282,7 @@ describe('ErrorBoundary', () => {
282282
it('does not set cause if non Error objected is thrown', () => {
283283
const TestAppThrowingString: React.FC<ErrorBoundaryProps> = ({ children, ...props }) => {
284284
const [isError, setError] = React.useState(false);
285-
function StringBam(): JSX.Element {
285+
function StringBam(): React.JSX.Element {
286286
throw 'bam';
287287
}
288288
return (
@@ -333,7 +333,7 @@ describe('ErrorBoundary', () => {
333333
it('handles when `error.cause` is nested', () => {
334334
const mockOnError = jest.fn();
335335

336-
function CustomBam(): JSX.Element {
336+
function CustomBam(): React.JSX.Element {
337337
const firstError = new Error('bam');
338338
const secondError = new Error('bam2');
339339
const thirdError = new Error('bam3');
@@ -378,7 +378,7 @@ describe('ErrorBoundary', () => {
378378
it('handles when `error.cause` is recursive', () => {
379379
const mockOnError = jest.fn();
380380

381-
function CustomBam(): JSX.Element {
381+
function CustomBam(): React.JSX.Element {
382382
const firstError = new Error('bam');
383383
const secondError = new Error('bam2');
384384
// @ts-expect-error Need to set cause on error

packages/react/test/reactrouterv3.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jest.mock('@sentry/core', () => {
6262

6363
describe('browserTracingReactRouterV3', () => {
6464
const routes = (
65-
<Route path="/" component={({ children }: { children: JSX.Element }) => <div>{children}</div>}>
65+
<Route path="/" component={({ children }: { children: React.JSX.Element }) => <div>{children}</div>}>
6666
<IndexRoute component={() => <div>Home</div>} />
6767
<Route path="about" component={() => <div>About</div>} />
6868
<Route path="features" component={() => <div>Features</div>} />

0 commit comments

Comments
 (0)