Skip to content

Commit

Permalink
fix(clerk-react): Infer React.JSX.Element instead of explicit JSX.Ele…
Browse files Browse the repository at this point in the history
…ment
  • Loading branch information
dstaley committed Dec 9, 2024
1 parent 8db1195 commit aea7348
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/lemon-planes-dress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@clerk/clerk-react': patch
---

Return components as `React.JSX.Element` instead of `JSX.Element`
10 changes: 5 additions & 5 deletions packages/react/src/components/controlComponents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { useAssertWrappedByClerkProvider } from '../hooks/useAssertWrappedByCler
import type { RedirectToSignInProps, RedirectToSignUpProps, WithClerkProp } from '../types';
import { withClerk } from './withClerk';

export const SignedIn = ({ children }: React.PropsWithChildren<unknown>): JSX.Element | null => {
export const SignedIn = ({ children }: React.PropsWithChildren<unknown>) => {
useAssertWrappedByClerkProvider('SignedIn');

const { userId } = useAuthContext();
Expand All @@ -25,7 +25,7 @@ export const SignedIn = ({ children }: React.PropsWithChildren<unknown>): JSX.El
return null;
};

export const SignedOut = ({ children }: React.PropsWithChildren<unknown>): JSX.Element | null => {
export const SignedOut = ({ children }: React.PropsWithChildren<unknown>) => {
useAssertWrappedByClerkProvider('SignedOut');

const { userId } = useAuthContext();
Expand All @@ -35,7 +35,7 @@ export const SignedOut = ({ children }: React.PropsWithChildren<unknown>): JSX.E
return null;
};

export const ClerkLoaded = ({ children }: React.PropsWithChildren<unknown>): JSX.Element | null => {
export const ClerkLoaded = ({ children }: React.PropsWithChildren<unknown>) => {
useAssertWrappedByClerkProvider('ClerkLoaded');

const isomorphicClerk = useIsomorphicClerkContext();
Expand All @@ -45,7 +45,7 @@ export const ClerkLoaded = ({ children }: React.PropsWithChildren<unknown>): JSX
return <>{children}</>;
};

export const ClerkLoading = ({ children }: React.PropsWithChildren<unknown>): JSX.Element | null => {
export const ClerkLoading = ({ children }: React.PropsWithChildren<unknown>) => {
useAssertWrappedByClerkProvider('ClerkLoading');

const isomorphicClerk = useIsomorphicClerkContext();
Expand Down Expand Up @@ -212,7 +212,7 @@ export const AuthenticateWithRedirectCallback = withClerk(
'AuthenticateWithRedirectCallback',
);

export const MultisessionAppSupport = ({ children }: React.PropsWithChildren<unknown>): JSX.Element => {
export const MultisessionAppSupport = ({ children }: React.PropsWithChildren<unknown>) => {
useAssertWrappedByClerkProvider('MultisessionAppSupport');

const session = useSessionContext();
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/contexts/ClerkContextProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type ClerkContextProvider = {

export type ClerkContextProviderState = Resources;

export function ClerkContextProvider(props: ClerkContextProvider): JSX.Element | null {
export function ClerkContextProvider(props: ClerkContextProvider) {
const { isomorphicClerkOptions, initialState, children } = props;
const { isomorphicClerk: clerk, loaded: clerkLoaded } = useLoadedIsomorphicClerk(isomorphicClerkOptions);

Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/contexts/ClerkProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type { ClerkProviderProps } from '../types';
import { withMaxAllowedInstancesGuard } from '../utils';
import { ClerkContextProvider } from './ClerkContextProvider';

function ClerkProviderBase(props: ClerkProviderProps): JSX.Element {
function ClerkProviderBase(props: ClerkProviderProps) {
const { initialState, children, __internal_bypassMissingPublishableKey, ...restIsomorphicClerkOptions } = props;
const { publishableKey = '', Clerk: userInitialisedClerk } = restIsomorphicClerkOptions;

Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/utils/useCustomElementPortal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export type UseCustomElementPortalParams = {
};

export type UseCustomElementPortalReturn = {
portal: () => JSX.Element;
portal: () => React.JSX.Element;
mount: (node: Element) => void;
unmount: () => void;
id: number;
Expand Down

0 comments on commit aea7348

Please sign in to comment.