From 6a1325867e0255890a6a4d9870f46969986eb691 Mon Sep 17 00:00:00 2001 From: "gitstart-app[bot]" <57568882+gitstart-app[bot]@users.noreply.github.com> Date: Wed, 3 Jan 2024 18:18:42 -0700 Subject: [PATCH] fix: Fix all TS warnings (fix-tsWarnings) (#12139) Co-authored-by: gitstart-calcom Co-authored-by: GitStart-Cal.com <121884634+gitstart-calcom@users.noreply.github.com> Co-authored-by: Peer Richelsen --- apps/web/lib/withNonce.tsx | 4 +- apps/web/pages/_app.tsx | 1 + apps/web/pages/_document.tsx | 3 +- apps/web/pages/auth/oauth2/authorize.tsx | 1 + apps/web/pages/event-types/index.tsx | 7 +--- apps/web/playwright/payment-apps.e2e.ts | 42 +++++++------------ apps/web/playwright/reschedule.e2e.ts | 1 + .../test/lib/handleChildrenEventTypes.test.ts | 5 +-- .../_utils/oauth/parseRefreshTokenResponse.ts | 1 + .../_utils/oauth/refreshOAuthTokens.ts | 1 + .../components/EventTypeAppCardInterface.tsx | 2 + .../basecamp3/lib/CalendarService.ts | 1 + packages/app-store/basecamp3/trpc/_router.ts | 1 + .../basecamp3/trpc/projectMutation.handler.ts | 6 ++- .../components/EventTypeAppCardInterface.tsx | 1 + .../app-store/paypal/lib/PaymentService.ts | 19 ++------- packages/lib/getEventTypeById.ts | 18 -------- packages/lib/hasEditPermissionForUser.ts | 2 - packages/lib/payment/getBooking.ts | 1 + .../loggedInViewer/integrations.handler.ts | 1 - .../team/listTeamAvailability.handler.ts | 2 +- .../server/routers/viewer/oAuth/_router.tsx | 2 +- 22 files changed, 42 insertions(+), 80 deletions(-) diff --git a/apps/web/lib/withNonce.tsx b/apps/web/lib/withNonce.tsx index 1649d6fab9..08e24bde0e 100644 --- a/apps/web/lib/withNonce.tsx +++ b/apps/web/lib/withNonce.tsx @@ -2,7 +2,7 @@ import type { GetServerSideProps } from "next"; import { csp } from "@lib/csp"; -export type WithNonceProps> = T & { +export type WithNonceProps> = T & { nonce?: string; }; @@ -11,7 +11,7 @@ export type WithNonceProps> = T & { * Note that if the Components are not adding any script tag then this is not needed. Even in absence of this, Document.getInitialProps would be able to generate nonce itself which it needs to add script tags common to all pages * There is no harm in wrapping a `getServerSideProps` fn with this even if it doesn't add any script tag. */ -export default function withNonce>( +export default function withNonce>( getServerSideProps: GetServerSideProps ): GetServerSideProps> { return async (context) => { diff --git a/apps/web/pages/_app.tsx b/apps/web/pages/_app.tsx index 89d53107ec..511bd9eb95 100644 --- a/apps/web/pages/_app.tsx +++ b/apps/web/pages/_app.tsx @@ -28,6 +28,7 @@ MyApp.getInitialProps = async (ctx: AppContextType) => { if (req) { const { getLocale } = await import("@calcom/features/auth/lib/getLocale"); + // eslint-disable-next-line @typescript-eslint/no-explicit-any newLocale = await getLocale(req as IncomingMessage & { cookies: Record }); } else if (typeof window !== "undefined" && window.calNewLocale) { newLocale = window.calNewLocale; diff --git a/apps/web/pages/_document.tsx b/apps/web/pages/_document.tsx index f1755445ed..2296b50224 100644 --- a/apps/web/pages/_document.tsx +++ b/apps/web/pages/_document.tsx @@ -32,7 +32,8 @@ class MyDocument extends Document { const newLocale = ctx.req && getLocaleModule - ? await getLocaleModule.getLocale(ctx.req as IncomingMessage & { cookies: Record }) + ? // eslint-disable-next-line @typescript-eslint/no-explicit-any + await getLocaleModule.getLocale(ctx.req as IncomingMessage & { cookies: Record }) : "en"; const asPath = ctx.asPath || ""; diff --git a/apps/web/pages/auth/oauth2/authorize.tsx b/apps/web/pages/auth/oauth2/authorize.tsx index c739495846..20061199c3 100644 --- a/apps/web/pages/auth/oauth2/authorize.tsx +++ b/apps/web/pages/auth/oauth2/authorize.tsx @@ -1,3 +1,4 @@ +/* eslint-disable react-hooks/exhaustive-deps */ import { useSession } from "next-auth/react"; import { useRouter } from "next/navigation"; import { useState, useEffect } from "react"; diff --git a/apps/web/pages/event-types/index.tsx b/apps/web/pages/event-types/index.tsx index 151221c8df..b068c7d687 100644 --- a/apps/web/pages/event-types/index.tsx +++ b/apps/web/pages/event-types/index.tsx @@ -907,6 +907,7 @@ const EventTypesPage = () => { const searchParams = useCompatSearchParams(); const { open } = useIntercom(); const { data: user } = useMeQuery(); + // eslint-disable-next-line @typescript-eslint/no-unused-vars const [showProfileBanner, setShowProfileBanner] = useState(false); const orgBranding = useOrgBranding(); const routerQuery = useRouterQuery(); @@ -919,12 +920,6 @@ const EventTypesPage = () => { staleTime: 1 * 60 * 60 * 1000, }); - function closeBanner() { - setShowProfileBanner(false); - document.cookie = `calcom-profile-banner=1;max-age=${60 * 60 * 24 * 90}`; // 3 months - showToast(t("we_wont_show_again"), "success"); - } - useEffect(() => { if (searchParams?.get("openIntercom") === "true") { open(); diff --git a/apps/web/playwright/payment-apps.e2e.ts b/apps/web/playwright/payment-apps.e2e.ts index 998fa50888..4aca2efb22 100644 --- a/apps/web/playwright/payment-apps.e2e.ts +++ b/apps/web/playwright/payment-apps.e2e.ts @@ -13,9 +13,7 @@ test.describe("Payment app", () => { const user = await users.create(); await user.apiLogin(); const paymentEvent = user.eventTypes.find((item) => item.slug === "paid"); - if (!paymentEvent) { - throw new Error("No payment event found"); - } + expect(paymentEvent).not.toBeNull(); await prisma.credential.create({ data: { type: "alby_payment", @@ -30,7 +28,7 @@ test.describe("Payment app", () => { }, }); - await page.goto(`event-types/${paymentEvent.id}?tabName=apps`); + await page.goto(`event-types/${paymentEvent?.id}?tabName=apps`); await page.locator("#event-type-form").getByRole("switch").click(); await page.getByPlaceholder("Price").click(); @@ -38,7 +36,7 @@ test.describe("Payment app", () => { await page.getByText("SatoshissatsCurrencyBTCPayment optionCollect payment on booking").click(); await page.getByTestId("update-eventtype").click(); - await page.goto(`${user.username}/${paymentEvent.slug}`); + await page.goto(`${user.username}/${paymentEvent?.slug}`); // expect 200 sats to be displayed in page expect(await page.locator("text=200 sats").first()).toBeTruthy(); @@ -55,9 +53,7 @@ test.describe("Payment app", () => { const user = await users.create(); await user.apiLogin(); const paymentEvent = user.eventTypes.find((item) => item.slug === "paid"); - if (!paymentEvent) { - throw new Error("No payment event found"); - } + expect(paymentEvent).not.toBeNull(); await prisma.credential.create({ data: { type: "stripe_payment", @@ -75,7 +71,7 @@ test.describe("Payment app", () => { }, }); - await page.goto(`event-types/${paymentEvent.id}?tabName=apps`); + await page.goto(`event-types/${paymentEvent?.id}?tabName=apps`); await page.locator("#event-type-form").getByRole("switch").click(); await page.getByTestId("stripe-currency-select").click(); await page.getByTestId("select-option-usd").click(); @@ -84,7 +80,7 @@ test.describe("Payment app", () => { await page.getByTestId("stripe-price-input").fill("350"); await page.getByTestId("update-eventtype").click(); - await page.goto(`${user.username}/${paymentEvent.slug}`); + await page.goto(`${user.username}/${paymentEvent?.slug}`); // expect 200 sats to be displayed in page expect(await page.locator("text=350").first()).toBeTruthy(); @@ -101,9 +97,7 @@ test.describe("Payment app", () => { const user = await users.create(); await user.apiLogin(); const paymentEvent = user.eventTypes.find((item) => item.slug === "paid"); - if (!paymentEvent) { - throw new Error("No payment event found"); - } + expect(paymentEvent).not.toBeNull(); await prisma.credential.create({ data: { type: "paypal_payment", @@ -116,7 +110,7 @@ test.describe("Payment app", () => { }, }); - await page.goto(`event-types/${paymentEvent.id}?tabName=apps`); + await page.goto(`event-types/${paymentEvent?.id}?tabName=apps`); await page.locator("#event-type-form").getByRole("switch").click(); @@ -131,7 +125,7 @@ test.describe("Payment app", () => { await page.getByText("$MXNCurrencyMexican pesoPayment option").click(); await page.getByTestId("update-eventtype").click(); - await page.goto(`${user.username}/${paymentEvent.slug}`); + await page.goto(`${user.username}/${paymentEvent?.slug}`); // expect 150 to be displayed in page expect(await page.locator("text=MX$150.00").first()).toBeTruthy(); @@ -149,9 +143,7 @@ test.describe("Payment app", () => { const user = await users.create(); await user.apiLogin(); const paymentEvent = user.eventTypes.find((item) => item.slug === "paid"); - if (!paymentEvent) { - throw new Error("No payment event found"); - } + expect(paymentEvent).not.toBeNull(); await prisma.credential.create({ data: { type: "alby_payment", @@ -160,7 +152,7 @@ test.describe("Payment app", () => { }, }); - await page.goto(`event-types/${paymentEvent.id}?tabName=apps`); + await page.goto(`event-types/${paymentEvent?.id}?tabName=apps`); await page.locator("#event-type-form").getByRole("switch").click(); @@ -177,9 +169,7 @@ test.describe("Payment app", () => { const user = await users.create(); await user.apiLogin(); const paymentEvent = user.eventTypes.find((item) => item.slug === "paid"); - if (!paymentEvent) { - throw new Error("No payment event found"); - } + expect(paymentEvent).not.toBeNull(); await prisma.credential.create({ data: { type: "paypal_payment", @@ -188,7 +178,7 @@ test.describe("Payment app", () => { }, }); - await page.goto(`event-types/${paymentEvent.id}?tabName=apps`); + await page.goto(`event-types/${paymentEvent?.id}?tabName=apps`); await page.locator("#event-type-form").getByRole("switch").click(); @@ -211,9 +201,7 @@ test.describe("Payment app", () => { await user.apiLogin(); // Any event should work here const paymentEvent = user.eventTypes.find((item) => item.slug === "paid"); - if (!paymentEvent) { - throw new Error("No payment event found"); - } + expect(paymentEvent).not.toBeNull(); await prisma.credential.create({ data: { @@ -225,7 +213,7 @@ test.describe("Payment app", () => { }, }); - await page.goto(`event-types/${paymentEvent.id}?tabName=apps`); + await page.goto(`event-types/${paymentEvent?.id}?tabName=apps`); await page.locator("#event-type-form").getByRole("switch").click(); // make sure Tracking ID is displayed diff --git a/apps/web/playwright/reschedule.e2e.ts b/apps/web/playwright/reschedule.e2e.ts index 3c31cb5678..bdb1edda01 100644 --- a/apps/web/playwright/reschedule.e2e.ts +++ b/apps/web/playwright/reschedule.e2e.ts @@ -252,6 +252,7 @@ test.describe("Reschedule Tests", async () => { let firstOfNextMonth = dayjs().add(1, "month").startOf("month"); // find first available slot of next month (available monday-friday) + // eslint-disable-next-line playwright/no-conditional-in-test while (firstOfNextMonth.day() < 1 || firstOfNextMonth.day() > 5) { firstOfNextMonth = firstOfNextMonth.add(1, "day"); } diff --git a/apps/web/test/lib/handleChildrenEventTypes.test.ts b/apps/web/test/lib/handleChildrenEventTypes.test.ts index 84d417733f..d167dfa4ae 100644 --- a/apps/web/test/lib/handleChildrenEventTypes.test.ts +++ b/apps/web/test/lib/handleChildrenEventTypes.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unused-vars */ import prismaMock from "../../../../tests/libs/__mocks__/prismaMock"; import type { EventType } from "@prisma/client"; @@ -97,7 +98,6 @@ describe("handleChildrenEventTypes", () => { it("Adds new users", async () => { // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore - // eslint-disable-next-line const { schedulingType, id, @@ -141,7 +141,6 @@ describe("handleChildrenEventTypes", () => { it("Updates old users", async () => { // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore - // eslint-disable-next-line const { schedulingType, id, @@ -237,7 +236,6 @@ describe("handleChildrenEventTypes", () => { it("Deletes existent event types for new users added", async () => { // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore - // eslint-disable-next-line const { schedulingType, id, @@ -282,7 +280,6 @@ describe("handleChildrenEventTypes", () => { it("Deletes existent event types for old users updated", async () => { // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore - // eslint-disable-next-line const { schedulingType, id, diff --git a/packages/app-store/_utils/oauth/parseRefreshTokenResponse.ts b/packages/app-store/_utils/oauth/parseRefreshTokenResponse.ts index fc0d7fc21d..958205707a 100644 --- a/packages/app-store/_utils/oauth/parseRefreshTokenResponse.ts +++ b/packages/app-store/_utils/oauth/parseRefreshTokenResponse.ts @@ -14,6 +14,7 @@ export type ParseRefreshTokenResponse = | z.infer | z.infer; +// eslint-disable-next-line @typescript-eslint/no-explicit-any const parseRefreshTokenResponse = (response: any, schema: z.ZodTypeAny) => { let refreshTokenResponse; const credentialSyncingEnabled = diff --git a/packages/app-store/_utils/oauth/refreshOAuthTokens.ts b/packages/app-store/_utils/oauth/refreshOAuthTokens.ts index b667154c90..999ada5245 100644 --- a/packages/app-store/_utils/oauth/refreshOAuthTokens.ts +++ b/packages/app-store/_utils/oauth/refreshOAuthTokens.ts @@ -1,5 +1,6 @@ import { APP_CREDENTIAL_SHARING_ENABLED } from "@calcom/lib/constants"; +// eslint-disable-next-line @typescript-eslint/no-explicit-any const refreshOAuthTokens = async (refreshFunction: () => any, appSlug: string, userId: number | null) => { // Check that app syncing is enabled and that the credential belongs to a user if (APP_CREDENTIAL_SHARING_ENABLED && process.env.CALCOM_CREDENTIAL_SYNC_ENDPOINT && userId) { diff --git a/packages/app-store/basecamp3/components/EventTypeAppCardInterface.tsx b/packages/app-store/basecamp3/components/EventTypeAppCardInterface.tsx index cc81f0237e..cbab47df35 100644 --- a/packages/app-store/basecamp3/components/EventTypeAppCardInterface.tsx +++ b/packages/app-store/basecamp3/components/EventTypeAppCardInterface.tsx @@ -18,9 +18,11 @@ const EventTypeAppCard: EventTypeAppCardComponent = function EventTypeAppCard({ useEffect(() => { setSelectedProject({ value: data?.projects.currentProject, + // eslint-disable-next-line @typescript-eslint/no-explicit-any label: data?.projects?.find((project: any) => project.id === data?.currentProject)?.name, }); setProjects( + // eslint-disable-next-line @typescript-eslint/no-explicit-any data?.projects?.map((project: any) => { return { value: project.id, diff --git a/packages/app-store/basecamp3/lib/CalendarService.ts b/packages/app-store/basecamp3/lib/CalendarService.ts index 783373ac96..46531a6dee 100644 --- a/packages/app-store/basecamp3/lib/CalendarService.ts +++ b/packages/app-store/basecamp3/lib/CalendarService.ts @@ -59,6 +59,7 @@ export default class BasecampCalendarService implements Calendar { constructor(credential: CredentialPayload) { this.integrationName = "basecamp3"; + // eslint-disable-next-line @typescript-eslint/no-explicit-any getAppKeysFromSlug("basecamp3").then(({ user_agent }: any) => { this.userAgent = user_agent as string; }); diff --git a/packages/app-store/basecamp3/trpc/_router.ts b/packages/app-store/basecamp3/trpc/_router.ts index ce2122375f..e3f9d71595 100644 --- a/packages/app-store/basecamp3/trpc/_router.ts +++ b/packages/app-store/basecamp3/trpc/_router.ts @@ -3,6 +3,7 @@ import { router } from "@calcom/trpc/server/trpc"; import { ZProjectMutationInputSchema } from "./projectMutation.schema"; +// eslint-disable-next-line @typescript-eslint/no-explicit-any const UNSTABLE_HANDLER_CACHE: any = {}; const appBasecamp3 = router({ diff --git a/packages/app-store/basecamp3/trpc/projectMutation.handler.ts b/packages/app-store/basecamp3/trpc/projectMutation.handler.ts index 6a9ffaeb9e..5f7afc2aa2 100644 --- a/packages/app-store/basecamp3/trpc/projectMutation.handler.ts +++ b/packages/app-store/basecamp3/trpc/projectMutation.handler.ts @@ -16,6 +16,10 @@ interface ProjectMutationHandlerOptions { input: TProjectMutationInputSchema; } +interface IDock { + id: number; + name: string; +} export const projectMutationHandler = async ({ ctx, input }: ProjectMutationHandlerOptions) => { const { user_agent } = await getAppKeysFromSlug("basecamp3"); const { user, prisma } = ctx; @@ -48,7 +52,7 @@ export const projectMutationHandler = async ({ ctx, input }: ProjectMutationHand } ); const scheduleJson = await scheduleResponse.json(); - const scheduleId = scheduleJson.dock.find((dock: any) => dock.name === "schedule").id; + const scheduleId = scheduleJson.dock.find((dock: IDock) => dock.name === "schedule").id; await prisma.credential.update({ where: { id: credential.id }, data: { key: { ...credentialKey, projectId: Number(projectId), scheduleId } }, diff --git a/packages/app-store/paypal/components/EventTypeAppCardInterface.tsx b/packages/app-store/paypal/components/EventTypeAppCardInterface.tsx index 008d875cb6..a51e7a91d5 100644 --- a/packages/app-store/paypal/components/EventTypeAppCardInterface.tsx +++ b/packages/app-store/paypal/components/EventTypeAppCardInterface.tsx @@ -56,6 +56,7 @@ const EventTypeAppCard: EventTypeAppCardComponent = function EventTypeAppCard({ setAppData("paymentOption", paymentOptions[0].value); } } + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); return ( diff --git a/packages/app-store/paypal/lib/PaymentService.ts b/packages/app-store/paypal/lib/PaymentService.ts index 9ad68c6846..ce3b1862bb 100644 --- a/packages/app-store/paypal/lib/PaymentService.ts +++ b/packages/app-store/paypal/lib/PaymentService.ts @@ -8,7 +8,6 @@ import { ErrorCode } from "@calcom/lib/errorCodes"; import logger from "@calcom/lib/logger"; import { safeStringify } from "@calcom/lib/safeStringify"; import prisma from "@calcom/prisma"; -import type { CalendarEvent } from "@calcom/types/Calendar"; import type { IAbstractPaymentService } from "@calcom/types/PaymentService"; import { paymentOptionEnum } from "../zod"; @@ -179,10 +178,7 @@ export class PaymentService implements IAbstractPaymentService { throw new Error("Paypal: Payment method could not be collected"); } } - chargeCard( - payment: Pick, - bookingId: number - ): Promise { + chargeCard(): Promise { throw new Error("Method not implemented."); } getPaymentPaidStatus(): Promise { @@ -191,19 +187,10 @@ export class PaymentService implements IAbstractPaymentService { getPaymentDetails(): Promise { throw new Error("Method not implemented."); } - afterPayment( - event: CalendarEvent, - booking: { - user: { email: string | null; name: string | null; timeZone: string } | null; - id: number; - startTime: { toISOString: () => string }; - uid: string; - }, - paymentData: Payment - ): Promise { + afterPayment(): Promise { return Promise.resolve(); } - deletePayment(paymentId: number): Promise { + deletePayment(): Promise { return Promise.resolve(false); } diff --git a/packages/lib/getEventTypeById.ts b/packages/lib/getEventTypeById.ts index 8df07f7868..0632aed00d 100644 --- a/packages/lib/getEventTypeById.ts +++ b/packages/lib/getEventTypeById.ts @@ -1,7 +1,6 @@ import { Prisma } from "@prisma/client"; import { getLocationGroupedOptions } from "@calcom/app-store/server"; -import type { StripeData } from "@calcom/app-store/stripepayment/lib/server"; import { getEventTypeAppData } from "@calcom/app-store/utils"; import type { LocationObject } from "@calcom/core/location"; import { getBookingFieldsWithSystemFields } from "@calcom/features/bookings/lib/getBookingFields"; @@ -9,7 +8,6 @@ import { parseBookingLimit, parseDurationLimit, parseRecurringEvent } from "@cal import { getUserAvatarUrl } from "@calcom/lib/getAvatarUrl"; import { getTranslation } from "@calcom/lib/server/i18n"; import type { PrismaClient } from "@calcom/prisma"; -import type { Credential } from "@calcom/prisma/client"; import { SchedulingType, MembershipRole } from "@calcom/prisma/enums"; import { customInputSchema, EventTypeMetaDataSchema } from "@calcom/prisma/zod-utils"; @@ -397,19 +395,3 @@ export default async function getEventTypeById({ }; return finalObj; } - -const getStripeCurrency = (stripeMetadata: { currency: string }, credentials: Credential[]) => { - // Favor the currency from the metadata as EventType.currency was not always set and should be deprecated - if (stripeMetadata.currency) { - return stripeMetadata.currency; - } - - // Legacy support for EventType.currency - const stripeCredential = credentials.find((integration) => integration.type === "stripe_payment"); - if (stripeCredential) { - return (stripeCredential.key as unknown as StripeData)?.default_currency || "usd"; - } - - // Fallback to USD but should not happen - return "usd"; -}; diff --git a/packages/lib/hasEditPermissionForUser.ts b/packages/lib/hasEditPermissionForUser.ts index 87d9e13e2f..c4adf2de40 100644 --- a/packages/lib/hasEditPermissionForUser.ts +++ b/packages/lib/hasEditPermissionForUser.ts @@ -2,8 +2,6 @@ import { prisma } from "@calcom/prisma"; import { MembershipRole } from "@calcom/prisma/enums"; import type { TrpcSessionUser } from "@calcom/trpc/server/trpc"; -const ROLES_WITH_EDIT_PERMISSION = [MembershipRole.ADMIN, MembershipRole.OWNER] as MembershipRole[]; - type InputOptions = { ctx: { user: NonNullable; diff --git a/packages/lib/payment/getBooking.ts b/packages/lib/payment/getBooking.ts index ec4e97c182..af0ea785ec 100644 --- a/packages/lib/payment/getBooking.ts +++ b/packages/lib/payment/getBooking.ts @@ -97,6 +97,7 @@ export async function getBooking(bookingId: number) { }), organizer: { email: user.email, + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion name: user.name!, timeZone: user.timeZone, timeFormat: getTimeFormatStringFromUserTimeFormat(user.timeFormat), diff --git a/packages/trpc/server/routers/loggedInViewer/integrations.handler.ts b/packages/trpc/server/routers/loggedInViewer/integrations.handler.ts index 70ea87aed5..7976abee83 100644 --- a/packages/trpc/server/routers/loggedInViewer/integrations.handler.ts +++ b/packages/trpc/server/routers/loggedInViewer/integrations.handler.ts @@ -51,7 +51,6 @@ export const integrationsHandler = async ({ ctx, input }: IntegrationsOptions) = extendsFeature, teamId, sortByMostPopular, - categories, appId, } = input; let credentials = await getUsersCredentials(user.id); diff --git a/packages/trpc/server/routers/viewer/availability/team/listTeamAvailability.handler.ts b/packages/trpc/server/routers/viewer/availability/team/listTeamAvailability.handler.ts index 58c6132ba8..6d6d709ffe 100644 --- a/packages/trpc/server/routers/viewer/availability/team/listTeamAvailability.handler.ts +++ b/packages/trpc/server/routers/viewer/availability/team/listTeamAvailability.handler.ts @@ -187,7 +187,7 @@ export const listTeamAvailabilityHandler = async ({ ctx, input }: GetOptions) => let nextCursor: typeof cursor | undefined = undefined; if (teamMembers && teamMembers.length > limit) { const nextItem = teamMembers.pop(); - nextCursor = nextItem!.id; + nextCursor = nextItem?.id; } const dateFrom = dayjs(input.startDate).tz(input.loggedInUsersTz).subtract(1, "day"); diff --git a/packages/trpc/server/routers/viewer/oAuth/_router.tsx b/packages/trpc/server/routers/viewer/oAuth/_router.tsx index 24a5fb0be7..b2936ed0a4 100644 --- a/packages/trpc/server/routers/viewer/oAuth/_router.tsx +++ b/packages/trpc/server/routers/viewer/oAuth/_router.tsx @@ -14,7 +14,7 @@ type OAuthRouterHandlerCache = { const UNSTABLE_HANDLER_CACHE: OAuthRouterHandlerCache = {}; export const oAuthRouter = router({ - getClient: authedProcedure.input(ZGetClientInputSchema).query(async ({ ctx, input }) => { + getClient: authedProcedure.input(ZGetClientInputSchema).query(async ({ input }) => { if (!UNSTABLE_HANDLER_CACHE.getClient) { UNSTABLE_HANDLER_CACHE.getClient = await import("./getClient.handler").then( (mod) => mod.getClientHandler