Skip to content

Commit 232bfc5

Browse files
authored
Merge pull request #1427 from authts/deprecated-1
use React.JSX instead of the global JSX namespace
2 parents 87f12dc + d7f353e commit 232bfc5

File tree

6 files changed

+16
-16
lines changed

6 files changed

+16
-16
lines changed

docs/react-oidc-context.api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export interface AuthContextProps extends AuthState {
5858
}
5959

6060
// @public
61-
export const AuthProvider: (props: AuthProviderProps) => JSX.Element;
61+
export const AuthProvider: (props: AuthProviderProps) => React_2.JSX.Element;
6262

6363
// @public (undocumented)
6464
export interface AuthProviderBaseProps {
@@ -107,7 +107,7 @@ export const withAuthenticationRequired: <P extends object>(Component: React_2.C
107107
// @public (undocumented)
108108
export interface WithAuthenticationRequiredProps {
109109
onBeforeSignin?: () => Promise<void> | void;
110-
OnRedirecting?: () => JSX.Element;
110+
OnRedirecting?: () => React_2.JSX.Element;
111111
signinRedirectArgs?: SigninRedirectArgs;
112112
}
113113

src/AuthProvider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ const UserManagerImpl =
152152
*
153153
* @public
154154
*/
155-
export const AuthProvider = (props: AuthProviderProps): JSX.Element => {
155+
export const AuthProvider = (props: AuthProviderProps): React.JSX.Element => {
156156
const {
157157
children,
158158

src/withAuthenticationRequired.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export interface WithAuthenticationRequiredProps {
1111
/**
1212
* Show a message when redirected to the signin page.
1313
*/
14-
OnRedirecting?: () => JSX.Element;
14+
OnRedirecting?: () => React.JSX.Element;
1515

1616
/**
1717
* Allows executing logic before the user is redirected to the signin page.
@@ -35,7 +35,7 @@ export const withAuthenticationRequired = <P extends object>(
3535
Component: React.ComponentType<P>,
3636
options: WithAuthenticationRequiredProps = {},
3737
): React.FC<P> => {
38-
const { OnRedirecting = (): JSX.Element => <></>, onBeforeSignin, signinRedirectArgs } = options;
38+
const { OnRedirecting = (): React.JSX.Element => <></>, onBeforeSignin, signinRedirectArgs } = options;
3939
const displayName = `withAuthenticationRequired(${Component.displayName || Component.name})`;
4040
const C: React.FC<P> = (props) => {
4141
const auth = useAuth();

test/helpers.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React from "react";
33
import { AuthProvider, type AuthProviderProps } from "../src/AuthProvider";
44

55
export const createWrapper = (opts: AuthProviderProps, strictMode = true) => {
6-
const AllProviders = ({ children }: React.PropsWithChildren): JSX.Element => {
6+
const AllProviders = ({ children }: React.PropsWithChildren): React.JSX.Element => {
77
const provider = <AuthProvider {...opts}>{children}</AuthProvider>;
88
if (!strictMode) {
99
return provider;

test/withAuth.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ describe("withAuth", () => {
1010
it("should wrap a class component, adding AuthContextProps to the component's `auth` prop", async () => {
1111
// arrange
1212
class MyComponent extends Component {
13-
render(): JSX.Element {
13+
render(): React.JSX.Element {
1414
for (const [k, v] of Object.entries(this.props)) {
1515
if (k === "auth") {
1616
return <>{k}: {Object.keys(v as Map<string, unknown>)}</>;
@@ -34,7 +34,7 @@ describe("withAuth", () => {
3434
it("should pass through wrapped component props", async () => {
3535
// arrange
3636
class MyPropsComponent extends Component<{ originalProp: string }> {
37-
render(): JSX.Element {
37+
render(): React.JSX.Element {
3838
return <>originalPropValue: {this.props.originalProp}</>;
3939
}
4040
}

test/withAuthenticationRequired.test.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe("withAuthenticationRequired", () => {
1515
authContext.signinRedirect = signinRedirectMock;
1616
useAuthMock.mockReturnValue(authContext);
1717

18-
const MyComponent = (): JSX.Element => <>Private</>;
18+
const MyComponent = (): React.JSX.Element => <>Private</>;
1919
const WrappedComponent = withAuthenticationRequired(MyComponent);
2020

2121
// act
@@ -40,7 +40,7 @@ describe("withAuthenticationRequired", () => {
4040
authContext.signinRedirect = signinRedirectMock;
4141
useAuthMock.mockReturnValue(authContext);
4242

43-
const MyComponent = (): JSX.Element => <>Private</>;
43+
const MyComponent = (): React.JSX.Element => <>Private</>;
4444
const WrappedComponent = withAuthenticationRequired(MyComponent);
4545

4646
// act
@@ -67,8 +67,8 @@ describe("withAuthenticationRequired", () => {
6767
authContext.signinRedirect = signinRedirectMock;
6868
useAuthMock.mockReturnValue(authContext);
6969

70-
const MyComponent = (): JSX.Element => <>Private</>;
71-
const OnRedirecting = (): JSX.Element => <>Redirecting</>;
70+
const MyComponent = (): React.JSX.Element => <>Private</>;
71+
const OnRedirecting = (): React.JSX.Element => <>Redirecting</>;
7272
const WrappedComponent = withAuthenticationRequired(MyComponent, {
7373
OnRedirecting,
7474
});
@@ -94,7 +94,7 @@ describe("withAuthenticationRequired", () => {
9494
authContext.signinRedirect = signinRedirectMock;
9595
useAuthMock.mockReturnValue(authContext);
9696

97-
const MyComponent = (): JSX.Element => <>Private</>;
97+
const MyComponent = (): React.JSX.Element => <>Private</>;
9898
const onBeforeSigninMock = jest.fn();
9999
const WrappedComponent = withAuthenticationRequired(MyComponent, {
100100
onBeforeSignin: onBeforeSigninMock,
@@ -124,7 +124,7 @@ describe("withAuthenticationRequired", () => {
124124
authContext.signinRedirect = signinRedirectMock;
125125
useAuthMock.mockReturnValue(authContext);
126126

127-
const MyComponent = (): JSX.Element => <>Private</>;
127+
const MyComponent = (): React.JSX.Element => <>Private</>;
128128
const WrappedComponent = withAuthenticationRequired(MyComponent, {
129129
signinRedirectArgs: {
130130
redirect_uri: "foo",
@@ -156,9 +156,9 @@ describe("withAuthenticationRequired", () => {
156156
authContext.signinRedirect = signinRedirectMock;
157157
useAuthMock.mockReturnValue(authContext);
158158

159-
const MyComponent = (): JSX.Element => <>Private</>;
159+
const MyComponent = (): React.JSX.Element => <>Private</>;
160160
const WrappedComponent = withAuthenticationRequired(MyComponent);
161-
const App = ({ foo }: { foo: number }): JSX.Element => (
161+
const App = ({ foo }: { foo: number }): React.JSX.Element => (
162162
<div>
163163
{foo}
164164
<AuthProvider {...settingsStub}>

0 commit comments

Comments
 (0)