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 TypeScript type errors across multiple files
Mike Caoa3733b042472
diff --git a/src/app/(main)/websites/[websiteId]/(reports)/funnels/Funnel.tsx b/src/app/(main)/websites/[websiteId]/(reports)/funnels/Funnel.tsxindex e336a3db6..54b4cd0f9 100644--- a/src/app/(main)/websites/[websiteId]/(reports)/funnels/Funnel.tsx+++ b/src/app/(main)/websites/[websiteId]/(reports)/funnels/Funnel.tsx@@ -42,7 +42,7 @@ export function Funnel({ id, name, type, parameters, websiteId }) {return (<Dialogtitle={formatMessage(labels.funnel)}- variant="modal"+ variant="sheet"style={{ minHeight: 300, minWidth: 400 }}><FunnelEditForm id={id} websiteId={websiteId} onClose={close} />diff --git a/src/app/(main)/websites/[websiteId]/(reports)/funnels/FunnelAddButton.tsx b/src/app/(main)/websites/[websiteId]/(reports)/funnels/FunnelAddButton.tsxindex 29b548032..725262aac 100644--- a/src/app/(main)/websites/[websiteId]/(reports)/funnels/FunnelAddButton.tsx+++ b/src/app/(main)/websites/[websiteId]/(reports)/funnels/FunnelAddButton.tsx@@ -16,7 +16,7 @@ export function FunnelAddButton({ websiteId }: { websiteId: string }) {</Button><Modal><Dialog- variant="modal"+ variant="sheet"title={formatMessage(labels.funnel)}style={{ minHeight: 375, minWidth: 600 }}>diff --git a/src/app/(main)/websites/[websiteId]/(reports)/goals/Goal.tsx b/src/app/(main)/websites/[websiteId]/(reports)/goals/Goal.tsxindex b6c4a11d6..39eb34890 100644--- a/src/app/(main)/websites/[websiteId]/(reports)/goals/Goal.tsx+++ b/src/app/(main)/websites/[websiteId]/(reports)/goals/Goal.tsx@@ -51,7 +51,7 @@ export function Goal({ id, name, type, parameters, websiteId, startDate, endDatereturn (<Dialogtitle={formatMessage(labels.goal)}- variant="modal"+ variant="sheet"style={{ minHeight: 300, minWidth: 400 }}><GoalEditForm id={id} websiteId={websiteId} onClose={close} />diff --git a/src/app/(main)/websites/[websiteId]/WebsiteChart.tsx b/src/app/(main)/websites/[websiteId]/WebsiteChart.tsxindex b2ea2a83e..165d2da21 100644--- a/src/app/(main)/websites/[websiteId]/WebsiteChart.tsx+++ b/src/app/(main)/websites/[websiteId]/WebsiteChart.tsx@@ -22,7 +22,11 @@ export function WebsiteChart({const chartData = useMemo(() => {if (data) {- const result = {+ const result: {+ pageviews: any[];+ sessions: any[];+ compare?: { pageviews: any[]; sessions: any[] };+ } = {pageviews,sessions,};diff --git a/src/app/(main)/websites/[websiteId]/WebsiteMenu.tsx b/src/app/(main)/websites/[websiteId]/WebsiteMenu.tsxindex 301895341..8025635a0 100644--- a/src/app/(main)/websites/[websiteId]/WebsiteMenu.tsx+++ b/src/app/(main)/websites/[websiteId]/WebsiteMenu.tsx@@ -10,7 +10,7 @@ import {} from '@umami/react-zen';import { Fragment } from 'react';import { useMessages, useNavigation } from '@/components/hooks';-import { Edit, More, Share } from '@/components/icons';+import { Edit, Ellipsis, Share } from '@/components/icons';export function WebsiteMenu({ websiteId }: { websiteId: string }) {const { formatMessage, labels } = useMessages();@@ -33,7 +33,7 @@ export function WebsiteMenu({ websiteId }: { websiteId: string }) {<MenuTrigger><Button variant="quiet"><Icon>- <More />+ <Ellipsis /></Icon></Button><Popover placement="bottom">diff --git a/src/components/hooks/useMessages.ts b/src/components/hooks/useMessages.tsindex d5bc2423d..c1bffa432 100644--- a/src/components/hooks/useMessages.ts+++ b/src/components/hooks/useMessages.ts@@ -13,7 +13,7 @@ interface UseMessages {messages: typeof messages;labels: typeof labels;getMessage: (id: string) => string;- getErrorMessage: (error: ApiError) => string | undefined;+ getErrorMessage: (error: string | Error | ApiError) => string | undefined;FormattedMessage: typeof FormattedMessage;}@@ -26,12 +26,16 @@ export function useMessages(): UseMessages {return message ? formatMessage(message) : id;};- const getErrorMessage = (error: ApiError) => {+ const getErrorMessage = (error: string | Error | ApiError) => {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';};diff --git a/src/components/input/LanguageButton.tsx b/src/components/input/LanguageButton.tsxindex ac43dcb6b..fe4380d38 100644--- a/src/components/input/LanguageButton.tsx+++ b/src/components/input/LanguageButton.tsx@@ -19,7 +19,7 @@ export function LanguageButton() {</Icon></Button><Popover placement="bottom end">- <Dialog variant="menu">+ <Dialog variant="sheet"><Grid columns="repeat(3, minmax(200px, 1fr))" overflow="hidden">{items.map(({ value, label }) => {return (diff --git a/src/declaration.d.ts b/src/declaration.d.tsindex 14bae12ab..17acee2bb 100644--- a/src/declaration.d.ts+++ b/src/declaration.d.ts@@ -16,3 +16,18 @@ declare module 'semver';declare module 'tsup';declare module 'uuid';declare module '@umami/esbuild-plugin-css-modules';++interface UmamiTracker {+ track: {+ (): Promise<string>;+ (eventName: string): Promise<string>;+ (eventName: string, obj: Record<string, any>): Promise<string>;+ (properties: Record<string, any>): Promise<string>;+ (eventFunction: (props: Record<string, any>) => Record<string, any>): Promise<string>;+ };+ identify: (data: Record<string, any>) => Promise<string>;+}++interface Window {+ umami: UmamiTracker;+}diff --git a/src/lib/db.ts b/src/lib/db.tsindex 7b6e8368b..7bee4816b 100644--- a/src/lib/db.ts+++ b/src/lib/db.ts@@ -5,7 +5,7 @@ export const KAFKA = 'kafka';export const KAFKA_PRODUCER = 'kafka-producer';// Fixes issue with converting bigint values-BigInt.prototype.toJSON = function () {+(BigInt.prototype as any).toJSON = function () {return Number(this);};diff --git a/src/lib/react.ts b/src/lib/react.tsindex 668cdf1fb..5a7ce2012 100644--- a/src/lib/react.ts+++ b/src/lib/react.ts@@ -10,7 +10,7 @@ import {export function getFragmentChildren(children: ReactNode) {return (children as ReactElement)?.type === Fragment- ? (children as ReactElement).props.children+ ? (children as ReactElement<{ children: ReactNode }>).props.children: children;}diff --git a/src/lib/request.ts b/src/lib/request.tsindex 42c449048..74ee432a3 100644--- a/src/lib/request.ts+++ b/src/lib/request.ts@@ -16,7 +16,7 @@ export async function parseRequest(const url = new URL(request.url);let query = Object.fromEntries(url.searchParams);let body = await getJsonBody(request);- let error: () => undefined | undefined;+ let error: (() => Response) | undefined;let auth = null;if (schema) {diff --git a/src/queries/sql/reports/getJourney.ts b/src/queries/sql/reports/getJourney.tsindex 283e0fad4..362f7bdba 100644--- a/src/queries/sql/reports/getJourney.ts+++ b/src/queries/sql/reports/getJourney.ts@@ -60,7 +60,7 @@ async function relationalQuery(endStepQuery: string;params: Record<string, string>;} {- const params = {};+ const params: Record<string, string> = {};let sequenceQuery = '';let startStepQuery = '';let endStepQuery = '';@@ -172,7 +172,7 @@ async function clickhouseQuery(endStepQuery: string;params: Record<string, string>;} {- const params = {};+ const params: Record<string, string> = {};let sequenceQuery = '';let startStepQuery = '';let endStepQuery = '';