Skip to content

Scheduling infrastructure for absolutely everyone.

fix: Some recently discovered type errors breaking build (not sure why undetected before) (#18432)

Alex van Andel890fc921482d
diff --git a/apps/web/app/WithEmbedSSR.test.ts b/apps/web/app/WithEmbedSSR.test.ts
index b760097fd32..975555d1bed 100644
--- a/apps/web/app/WithEmbedSSR.test.ts
+++ b/apps/web/app/WithEmbedSSR.test.ts
@@ -13,6 +13,9 @@ export function createMockNextJsRequest(...args: Parameters<typeof createMocks>)
return createMocks<CustomNextApiRequest, CustomNextApiResponse>(...args);
}
+// eslint-disable-next-line @typescript-eslint/no-empty-function
+const noop = () => {};
+
vi.mock("next/navigation", () => ({
redirect: vi.fn(),
notFound: vi.fn(),
@@ -86,7 +89,7 @@ describe("withEmbedSsrAppDir", () => {
embed: "namespace1",
},
})
- ).catch(() => {});
+ ).catch(noop);
expect(redirect).toHaveBeenCalledWith("/reschedule/embed?layout=week_view&embed=namespace1");
});
@@ -105,7 +108,7 @@ describe("withEmbedSsrAppDir", () => {
embed: "namespace1",
},
})
- ).catch(() => {});
+ ).catch(noop);
expect(redirect).toHaveBeenCalledWith(
"/reschedule/embed?redirectParam=1&layout=week_view&embed=namespace1"
@@ -126,7 +129,7 @@ describe("withEmbedSsrAppDir", () => {
embed: "",
},
})
- ).catch(() => {});
+ ).catch(noop);
expect(redirect).toHaveBeenCalledWith("/reschedule/embed?redirectParam=1&layout=week_view&embed=");
});
@@ -147,7 +150,7 @@ describe("withEmbedSsrAppDir", () => {
embed: "namespace1",
},
})
- ).catch(() => {});
+ ).catch(noop);
expect(redirect).toHaveBeenCalledWith(
"https://calcom.cal.local/owner/embed?layout=week_view&embed=namespace1"
@@ -168,7 +171,7 @@ describe("withEmbedSsrAppDir", () => {
embed: "namespace1",
},
})
- ).catch(() => {});
+ ).catch(noop);
expect(redirect).toHaveBeenCalledWith(
"http://calcom.cal.local/owner/embed?layout=week_view&embed=namespace1"
@@ -189,7 +192,7 @@ describe("withEmbedSsrAppDir", () => {
embed: "namespace1",
},
})
- ).catch(() => {});
+ ).catch(noop);
expect(redirect).toHaveBeenCalledWith(
"/calcom.cal.local/owner/embed?layout=week_view&embed=namespace1"
@@ -239,7 +242,7 @@ describe("withEmbedSsrAppDir", () => {
embed: "",
},
})
- ).catch(() => {});
+ ).catch(noop);
expect(notFound).toHaveBeenCalled();
});
diff --git a/apps/web/app/_utils.tsx b/apps/web/app/_utils.tsx
index 015e1c1e6a1..a487888800f 100644
--- a/apps/web/app/_utils.tsx
+++ b/apps/web/app/_utils.tsx
@@ -33,7 +33,7 @@ const createI18nInstance = async (locale: string, ns: string) => {
return _i18n;
};
-const getTranslationWithCache = async (locale: string, ns: string = "common") => {
+const getTranslationWithCache = async (locale: string, ns = "common") => {
const localeWithFallback = locale ?? "en";
const i18n = await createI18nInstance(localeWithFallback, ns);
return i18n.getFixedT(localeWithFallback, ns);
diff --git a/apps/web/app/api/customer-card/route.ts b/apps/web/app/api/customer-card/route.ts
index 1ddce87154d..0d89278cea6 100644
--- a/apps/web/app/api/customer-card/route.ts
+++ b/apps/web/app/api/customer-card/route.ts
@@ -20,7 +20,7 @@ const inputSchema = z.object({
cardKeys: z.array(z.string()),
});
-export async function handler(request: Request) {
+async function handler(request: Request) {
const headersList = headers();
const requestBody = await request.json();
diff --git a/apps/web/app/bookings/[status]/page.tsx b/apps/web/app/bookings/[status]/page.tsx
index b8a21f79bf5..6e859d38ca3 100644
--- a/apps/web/app/bookings/[status]/page.tsx
+++ b/apps/web/app/bookings/[status]/page.tsx
@@ -1,4 +1,4 @@
-import { PageProps } from "app/_types";
+import type { PageProps } from "app/_types";
import { _generateMetadata } from "app/_utils";
import { WithLayout } from "app/layoutHOC";
import { redirect } from "next/navigation";
diff --git a/apps/web/app/future/org/[orgSlug]/embed/page.tsx b/apps/web/app/future/org/[orgSlug]/embed/page.tsx
index 0f378c48cb0..3a592b9af76 100644
--- a/apps/web/app/future/org/[orgSlug]/embed/page.tsx
+++ b/apps/web/app/future/org/[orgSlug]/embed/page.tsx
@@ -1,6 +1,4 @@
import withEmbedSsrAppDir from "app/WithEmbedSSR";
-import type { PageProps as _PageProps } from "app/_types";
-import { _generateMetadata } from "app/_utils";
import { WithLayout } from "app/layoutHOC";
import { getServerSideProps } from "@lib/team/[slug]/getServerSideProps";
diff --git a/apps/web/app/future/team/[slug]/[type]/embed/page.tsx b/apps/web/app/future/team/[slug]/[type]/embed/page.tsx
index 4c15acd8776..3430e611a7c 100644
--- a/apps/web/app/future/team/[slug]/[type]/embed/page.tsx
+++ b/apps/web/app/future/team/[slug]/[type]/embed/page.tsx
@@ -1,6 +1,4 @@
import withEmbedSsrAppDir from "app/WithEmbedSSR";
-import type { PageProps as _PageProps } from "app/_types";
-import { _generateMetadata } from "app/_utils";
import { WithLayout } from "app/layoutHOC";
import { getServerSideProps } from "@lib/team/[slug]/[type]/getServerSideProps";
diff --git a/apps/web/app/future/team/[slug]/embed/page.tsx b/apps/web/app/future/team/[slug]/embed/page.tsx
index 9978957cb9a..5145f0ed0f4 100644
--- a/apps/web/app/future/team/[slug]/embed/page.tsx
+++ b/apps/web/app/future/team/[slug]/embed/page.tsx
@@ -1,7 +1,4 @@
-import { withAppDirSsr } from "app/WithAppDirSsr";
import withEmbedSsrAppDir from "app/WithEmbedSSR";
-import type { PageProps as _PageProps } from "app/_types";
-import { _generateMetadata } from "app/_utils";
import { WithLayout } from "app/layoutHOC";
import { getServerSideProps } from "@lib/team/[slug]/getServerSideProps";
diff --git a/apps/web/app/layout.tsx b/apps/web/app/layout.tsx
index ab000ce5d06..68b33252227 100644
--- a/apps/web/app/layout.tsx
+++ b/apps/web/app/layout.tsx
@@ -76,6 +76,7 @@ export default async function RootLayout({ children }: { children: React.ReactNo
<script
nonce={nonce}
id="headScript"
+ // eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{
__html: `
window.calNewLocale = "${locale}";
diff --git a/apps/web/lib/d/[link]/[slug]/getServerSideProps.tsx b/apps/web/lib/d/[link]/[slug]/getServerSideProps.tsx
index ecc97927b66..50f68a969a5 100644
--- a/apps/web/lib/d/[link]/[slug]/getServerSideProps.tsx
+++ b/apps/web/lib/d/[link]/[slug]/getServerSideProps.tsx
@@ -1,3 +1,4 @@
+import type { EmbedProps } from "app/WithEmbedSSR";
import type { GetServerSidePropsContext } from "next";
import { z } from "zod";
@@ -12,7 +13,6 @@ import { RedirectType } from "@calcom/prisma/enums";
import { getTemporaryOrgRedirect } from "@lib/getTemporaryOrgRedirect";
import type { inferSSRProps } from "@lib/types/inferSSRProps";
-import type { EmbedProps } from "app/WithEmbedSSR";
export type PageProps = inferSSRProps<typeof getServerSideProps> & EmbedProps;
diff --git a/packages/features/data-table/components/DataTable.tsx b/packages/features/data-table/components/DataTable.tsx
index a58f3d47843..9a2e8fec7dc 100644
--- a/packages/features/data-table/components/DataTable.tsx
+++ b/packages/features/data-table/components/DataTable.tsx
@@ -14,7 +14,7 @@ import { Icon, TableNew, TableBody, TableCell, TableHead, TableHeader, TableRow
import { usePersistentColumnResizing } from "../lib/resizing";
-export interface DataTableProps<TData, TValue> {
+export type DataTableProps<TData, TValue> = {
table: ReactTableType<TData>;
tableContainerRef: React.RefObject<HTMLDivElement>;
isPending?: boolean;
@@ -26,7 +26,7 @@ export interface DataTableProps<TData, TValue> {
children?: React.ReactNode;
identifier?: string;
enableColumnResizing?: boolean;
-}
+};
export function DataTable<TData, TValue>({
table,
@@ -89,7 +89,8 @@ export function DataTable<TData, TValue>({
usePersistentColumnResizing({
enabled: Boolean(enableColumnResizing),
table,
- identifier,
+ // TODO: Figure out why 'identifier' somehow types to string | null
+ identifier: identifier || undefined,
});
return (