diff --git a/__tests__/helpers.tsx b/__tests__/helpers.tsx index 1a8e5e8c..a55f08b2 100644 --- a/__tests__/helpers.tsx +++ b/__tests__/helpers.tsx @@ -8,7 +8,7 @@ export const createWrapper = ({ }: Partial = {}) => { return function Wrapper({ children, - }: PropsWithChildren>): JSX.Element { + }: PropsWithChildren>) { return ( {children} diff --git a/__tests__/ssr.test.tsx b/__tests__/ssr.test.tsx index 754ba914..1ed55682 100644 --- a/__tests__/ssr.test.tsx +++ b/__tests__/ssr.test.tsx @@ -13,7 +13,7 @@ describe('In a Node SSR environment', () => { ReactDOMServer.renderToString( - {(value): JSX.Element => { + {(value) => { ({ isLoading, isAuthenticated, user, loginWithRedirect } = value); return
App
; }} diff --git a/__tests__/with-auth0.test.tsx b/__tests__/with-auth0.test.tsx index 6ea18ebf..04648c95 100644 --- a/__tests__/with-auth0.test.tsx +++ b/__tests__/with-auth0.test.tsx @@ -7,7 +7,7 @@ import withAuth0, { WithAuth0Props } from '../src/with-auth0'; describe('withAuth0', () => { it('should wrap a class component', () => { class MyComponent extends Component { - render(): JSX.Element { + render() { return <>hasAuth: {`${!!this.props.auth0}`}; } } @@ -19,7 +19,7 @@ describe('withAuth0', () => { it('should wrap a class component and provide context', () => { const context = React.createContext(initialContext); class MyComponent extends Component { - render(): JSX.Element { + render() { return <>hasAuth: {`${!!this.props.auth0}`}; } } diff --git a/__tests__/with-authentication-required.test.tsx b/__tests__/with-authentication-required.test.tsx index 7d69456a..fc8d2b95 100644 --- a/__tests__/with-authentication-required.test.tsx +++ b/__tests__/with-authentication-required.test.tsx @@ -12,7 +12,7 @@ const mockClient = jest.mocked(new Auth0Client({ clientId: '', domain: '' })); describe('withAuthenticationRequired', () => { it('should block access to a private component when not authenticated', async () => { mockClient.getUser.mockResolvedValue(undefined); - const MyComponent = (): JSX.Element => <>Private; + const MyComponent = () => <>Private; const WrappedComponent = withAuthenticationRequired(MyComponent); render( @@ -27,7 +27,7 @@ describe('withAuthenticationRequired', () => { it('should allow access to a private component when authenticated', async () => { mockClient.getUser.mockResolvedValue({ name: '__test_user__' }); - const MyComponent = (): JSX.Element => <>Private; + const MyComponent = () => <>Private; const WrappedComponent = withAuthenticationRequired(MyComponent); await act(() => { render( @@ -49,8 +49,8 @@ describe('withAuthenticationRequired', () => { const deferred = defer(); mockClient.getUser.mockResolvedValue(deferred.promise); - const MyComponent = (): JSX.Element => <>Private; - const OnRedirecting = (): JSX.Element => <>Redirecting; + const MyComponent = () => <>Private; + const OnRedirecting = () => <>Redirecting; const WrappedComponent = withAuthenticationRequired(MyComponent, { onRedirecting: OnRedirecting, }); @@ -84,7 +84,7 @@ describe('withAuthenticationRequired', () => { mockClient.loginWithRedirect.mockImplementationOnce(async () => { callOrder.push('loginWithRedirect'); }); - const MyComponent = (): JSX.Element => <>Private; + const MyComponent = () => <>Private; const OnBeforeAuthentication = jest .fn() .mockImplementationOnce(async () => { @@ -112,7 +112,7 @@ describe('withAuthenticationRequired', () => { it('should pass additional options on to loginWithRedirect', async () => { mockClient.getUser.mockResolvedValue(undefined); - const MyComponent = (): JSX.Element => <>Private; + const MyComponent = () => <>Private; const WrappedComponent = withAuthenticationRequired(MyComponent, { loginOptions: { fragment: 'foo', @@ -134,7 +134,7 @@ describe('withAuthenticationRequired', () => { it('should merge additional appState with the returnTo', async () => { mockClient.getUser.mockResolvedValue(undefined); - const MyComponent = (): JSX.Element => <>Private; + const MyComponent = () => <>Private; const WrappedComponent = withAuthenticationRequired(MyComponent, { loginOptions: { appState: { @@ -162,7 +162,7 @@ describe('withAuthenticationRequired', () => { it('should accept a returnTo function', async () => { mockClient.getUser.mockResolvedValue(undefined); - const MyComponent = (): JSX.Element => <>Private; + const MyComponent = () => <>Private; const WrappedComponent = withAuthenticationRequired(MyComponent, { returnTo: () => '/foo', }); @@ -184,9 +184,9 @@ describe('withAuthenticationRequired', () => { it('should call loginWithRedirect only once even if parent state changes', async () => { mockClient.getUser.mockResolvedValue(undefined); - const MyComponent = (): JSX.Element => <>Private; + const MyComponent = () => <>Private; const WrappedComponent = withAuthenticationRequired(MyComponent); - const App = ({ foo }: { foo: number }): JSX.Element => ( + const App = ({ foo }: { foo: number }) => (
{foo} @@ -210,7 +210,7 @@ describe('withAuthenticationRequired', () => { mockClient.getUser.mockResolvedValueOnce({ name: '__test_user__' }); mockClient.getUser.mockResolvedValueOnce(undefined); const context = React.createContext(initialContext); - const MyComponent = (): JSX.Element => <>Private; + const MyComponent = () => <>Private; const WrappedComponent = withAuthenticationRequired(MyComponent, { context, }); @@ -241,7 +241,7 @@ describe('withAuthenticationRequired', () => { mockClient.getUser.mockResolvedValueOnce(undefined); mockClient.getUser.mockResolvedValueOnce({ name: '__test_user__' }); const context = React.createContext(initialContext); - const MyComponent = (): JSX.Element => <>Private; + const MyComponent = () => <>Private; const WrappedComponent = withAuthenticationRequired(MyComponent, { context, }); diff --git a/src/auth0-provider.tsx b/src/auth0-provider.tsx index bfa1af30..19fa718e 100644 --- a/src/auth0-provider.tsx +++ b/src/auth0-provider.tsx @@ -132,7 +132,7 @@ const defaultOnRedirectCallback = (appState?: AppState): void => { * * Provides the Auth0Context to its child components. */ -const Auth0Provider = (opts: Auth0ProviderOptions): JSX.Element => { +const Auth0Provider = (opts: Auth0ProviderOptions) => { const { children, skipRedirectCallback, diff --git a/src/with-auth0.tsx b/src/with-auth0.tsx index 623b7b35..71017fd5 100644 --- a/src/with-auth0.tsx +++ b/src/with-auth0.tsx @@ -30,10 +30,10 @@ const withAuth0 =

( Component: ComponentType

, context = Auth0Context ): ComponentType> => { - return function WithAuth(props): JSX.Element { + return function WithAuth(props) { return ( - {(auth: Auth0ContextInterface): JSX.Element => ( + {(auth: Auth0ContextInterface) => ( )} diff --git a/src/with-authentication-required.tsx b/src/with-authentication-required.tsx index 2073f215..48e11bbb 100644 --- a/src/with-authentication-required.tsx +++ b/src/with-authentication-required.tsx @@ -8,12 +8,12 @@ import Auth0Context, { /** * @ignore */ -const defaultOnRedirecting = (): JSX.Element => <>; +const defaultOnRedirecting = () => <>; /** * @ignore */ -const defaultOnBeforeAuthentication = async (): Promise => {/* noop */}; +const defaultOnBeforeAuthentication = async (): Promise => {/* noop */ }; /** * @ignore @@ -52,7 +52,7 @@ export interface WithAuthenticationRequiredOptions { * * Render a message to show that the user is being redirected to the login. */ - onRedirecting?: () => JSX.Element; + onRedirecting?: () => React.JSX.Element; /** * ```js * withAuthenticationRequired(Profile, { @@ -98,7 +98,7 @@ const withAuthenticationRequired =

( Component: ComponentType

, options: WithAuthenticationRequiredOptions = {} ): FC

=> { - return function WithAuthenticationRequired(props: P): JSX.Element { + return function WithAuthenticationRequired(props: P) { const { returnTo = defaultReturnTo, onRedirecting = defaultOnRedirecting,