frontend: type Clerk button wrappers (no any)

This commit is contained in:
Ishaan (OpenClaw)
2026-02-06 22:59:21 +00:00
parent ba21ca9b61
commit 720c19f852

View File

@@ -15,6 +15,11 @@ import {
useUser as clerkUseUser, useUser as clerkUseUser,
} from "@clerk/nextjs"; } from "@clerk/nextjs";
import type {
SignInButtonProps,
SignOutButtonProps,
} from "@clerk/nextjs";
export function isClerkEnabled(): boolean { export function isClerkEnabled(): boolean {
// Invariant: Clerk is disabled ONLY when the publishable key is absent. // Invariant: Clerk is disabled ONLY when the publishable key is absent.
// If a key is present, we assume Clerk is intended to be enabled and we let // If a key is present, we assume Clerk is intended to be enabled and we let
@@ -32,13 +37,13 @@ export function SignedOut(props: { children: ReactNode }) {
return <ClerkSignedOut>{props.children}</ClerkSignedOut>; return <ClerkSignedOut>{props.children}</ClerkSignedOut>;
} }
// Accept arbitrary Clerk component props so existing call sites don't need edits. // Keep the same prop surface as Clerk components so call sites don't need edits.
export function SignInButton(props: any) { export function SignInButton(props: SignInButtonProps) {
if (!isClerkEnabled()) return null; if (!isClerkEnabled()) return null;
return <ClerkSignInButton {...props} />; return <ClerkSignInButton {...props} />;
} }
export function SignOutButton(props: any) { export function SignOutButton(props: SignOutButtonProps) {
if (!isClerkEnabled()) return null; if (!isClerkEnabled()) return null;
return <ClerkSignOutButton {...props} />; return <ClerkSignOutButton {...props} />;
} }