Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.
TypeScript analyticsaudience-segmentationchartscohort-analysisgoogle-analyticsproduct-analyticsstatisticsuser-journeyweb-analytics
Fix build type errors in LinkButton and useMessages
Mike Cao365895c38983
diff --git a/src/components/common/LinkButton.tsx b/src/components/common/LinkButton.tsxindex 35292ba45..990feb1c8 100644--- a/src/components/common/LinkButton.tsx+++ b/src/components/common/LinkButton.tsx@@ -25,17 +25,15 @@ export function LinkButton({}: LinkButtonProps) {const { dir } = useLocale();- return (- <Button {...props} variant={variant} asChild>- {asAnchor ? (- <a href={href} target={target}>- {children}- </a>- ) : (- <Link href={href} dir={dir} scroll={scroll} target={target} prefetch={prefetch}>- {children}- </Link>- )}- </Button>+ const linkElement = asAnchor ? (+ <a href={href} target={target}>+ {children}+ </a>+ ) : (+ <Link href={href} dir={dir} scroll={scroll} target={target} prefetch={prefetch}>+ {children}+ </Link>);++ return <Button {...props} variant={variant} render={linkElement} />;}diff --git a/src/components/hooks/useMessages.ts b/src/components/hooks/useMessages.tsindex b8ed46f2e..4519aefbd 100644--- a/src/components/hooks/useMessages.ts+++ b/src/components/hooks/useMessages.ts@@ -7,12 +7,16 @@ export function useMessages() {const getMessage = (id: string) => t(`message.${id}`);- const getErrorMessage = (error: ApiError) => {+ const getErrorMessage = (error: string | Error | undefined) => {if (!error) {return undefined;}- const code = error?.code;+ if (typeof error === 'string') {+ return error;+ }++ const code = (error as ApiError)?.code;return code ? getMessage(code) : error?.message || 'Unknown error';};