Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(clerk-react): Infer React.JSX.Element instead of explicit JSX.Element #4740

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading