refactor: Typescript fixes and updates for bumping ts version to 5.8.2 (#19690)

* Typescript fixes and updates for bumping ts version to 5.8.2

* Different TS versions do see an error, so @ts-ignore'ing

* Attempt this fix for ignoring createDecipher/createCipher fns

* Remove @ts-expect-error
This commit is contained in:
Alex van Andel authored and GitHub committed 2025-03-05 09:17:08 -03:00
1 parent 1545a8ec82
commit 6f62c6ad5d
17 files changed
+28 -23

No files matched your search

@@ -54,7 +54,7 @@ function AppListCardWebWrapper(props: AppListCardProps) {
useEffect(() => {
if (shouldHighlight && highlight && searchParams !== null && pathname !== null) {
timeoutRef.current = setTimeout(() => {
const _searchParams = new URLSearchParams(searchParams);
const _searchParams = new URLSearchParams(searchParams.toString());
_searchParams.delete("hl");
_searchParams.delete("category"); // this comes from params, not from search params
@@ -1,3 +1,5 @@
export const isBookingDryRun = (searchParams: URLSearchParams) => {
import type { ReadonlyURLSearchParams } from "next/navigation";
export const isBookingDryRun = (searchParams: URLSearchParams | ReadonlyURLSearchParams) => {
return searchParams.get("cal.isBookingDryRun") === "true";
};
@@ -183,7 +183,7 @@ export const getEventTypesFromDB = async (eventTypeId: number) => {
recurringEvent: parseRecurringEvent(eventType?.recurringEvent),
customInputs: customInputSchema.array().parse(eventType?.customInputs || []),
locations: (eventType?.locations ?? []) as LocationObject[],
bookingFields: getBookingFieldsWithSystemFields({ ...restEventType, isOrgTeamEvent } || {}),
bookingFields: getBookingFieldsWithSystemFields({ ...restEventType, isOrgTeamEvent }),
rrSegmentQueryValue: rrSegmentQueryValueSchema.parse(eventType.rrSegmentQueryValue) ?? null,
isDynamic: false,
};
@@ -43,7 +43,7 @@ export function getOrgSlug(hostname: string, forcedSlug?: string) {
return null;
}
// Define which is the current domain/subdomain
const slug = hostname.replace(`.${currentHostname}` ?? "", "");
const slug = hostname.replace(currentHostname ? `.${currentHostname}` : "", "");
const hasNoDotInSlug = slug.indexOf(".") === -1;
if (hasNoDotInSlug) {
return slug;
+3 -3
View File
@@ -98,7 +98,7 @@ function useRouterHelpers() {
const pathname = usePathname();
const goto = (newSearchParams: Record<string, string>) => {
const newQuery = new URLSearchParams(searchParams ?? undefined);
const newQuery = new URLSearchParams(searchParams.toString());
newQuery.delete("slug");
newQuery.delete("pages");
Object.keys(newSearchParams).forEach((key) => {
@@ -109,7 +109,7 @@ function useRouterHelpers() {
};
const removeQueryParams = (queryParams: string[]) => {
const params = new URLSearchParams(searchParams ?? undefined);
const params = new URLSearchParams(searchParams.toString());
queryParams.forEach((param) => {
params.delete(param);
@@ -703,7 +703,7 @@ const EmbedTypeCodeAndPreviewDialogContent = ({
const teamSlug = !!eventTypeData?.team ? eventTypeData.team.slug : null;
const s = (href: string) => {
const _searchParams = new URLSearchParams(searchParams ?? undefined);
const _searchParams = new URLSearchParams(searchParams.toString());
const [a, b] = href.split("=");
_searchParams.set(a, b);
return `${pathname?.split("?")[0] ?? ""}?${_searchParams.toString()}`;
@@ -917,7 +917,9 @@ export const IntervalLimitsManager = <K extends "durationLimits" | "bookingLimit
setValue(
propertyName,
// @ts-expect-error FIXME Fix these typings
// TODO: Remove @ts-ignore, type error no longer exists in later TS versions.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
{
...watchIntervalLimits,
[rest.value]: defaultLimit,
@@ -47,7 +47,9 @@ export const useSchedule = ({
selectedDate,
});
const searchParams = useSearchParams();
const routedTeamMemberIds = searchParams ? getRoutedTeamMemberIdsFromSearchParams(searchParams) : null;
const routedTeamMemberIds = searchParams
? getRoutedTeamMemberIdsFromSearchParams(new URLSearchParams(searchParams.toString()))
: null;
const skipContactOwner = searchParams ? searchParams.get("cal.skipContactOwner") === "true" : false;
const _cacheParam = searchParams?.get("cal.cache");
const shouldServeCache = _cacheParam ? _cacheParam === "true" : undefined;
@@ -110,7 +110,7 @@ const getNavigationItems = (orgBranding: OrganizationBranding): NavigationItemTy
{
name: "bookings",
href: "/insights",
isCurrent: ({ pathname: path }) => path == "/insights" ?? false,
isCurrent: ({ pathname: path }) => path === "/insights",
},
{
name: "routing",