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:
@@ -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;
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -190,7 +190,7 @@ export const useBookingSuccessRedirect = () => {
|
||||
...query,
|
||||
...bookingExtraParams,
|
||||
},
|
||||
searchParams: searchParams ?? undefined,
|
||||
searchParams: new URLSearchParams(searchParams.toString()),
|
||||
});
|
||||
|
||||
newSearchParams.forEach((value, key) => {
|
||||
|
||||
@@ -15,7 +15,6 @@ const IV_LENGTH = 16; // AES blocksize
|
||||
export const symmetricEncrypt = function (text: string, key: string) {
|
||||
const _key = Buffer.from(key, "latin1");
|
||||
const iv = crypto.randomBytes(IV_LENGTH);
|
||||
|
||||
const cipher = crypto.createCipheriv(ALGORITHM, _key, iv);
|
||||
let ciphered = cipher.update(text, INPUT_ENCODING, OUTPUT_ENCODING);
|
||||
ciphered += cipher.final(OUTPUT_ENCODING);
|
||||
|
||||
@@ -10,7 +10,11 @@ export const slugify = (str: string, forDisplayingInput?: boolean) => {
|
||||
.toLowerCase() // Convert to lowercase
|
||||
.trim() // Remove whitespace from both sides
|
||||
.normalize("NFD") // Normalize to decomposed form for handling accents
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
.replace(/\p{Diacritic}/gu, "") // Remove any diacritics (accents) from characters
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
.replace(/[^.\p{L}\p{N}\p{Zs}\p{Emoji}]+/gu, "-") // Replace any non-alphanumeric characters (including Unicode and except "." period) with a dash
|
||||
.replace(/[\s_#]+/g, "-") // Replace whitespace, # and underscores with a single dash
|
||||
.replace(/^-+/, "") // Remove dashes from start
|
||||
|
||||
@@ -22,6 +22,6 @@
|
||||
"zod": "^3.22.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^5.3.3"
|
||||
"typescript": "^5.8.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,9 +74,9 @@ export const adminUpdateHandler = async ({ input }: AdminUpdateOptions) => {
|
||||
isAdminReviewed: organizationSettings?.isAdminReviewed,
|
||||
orgAutoAcceptEmail:
|
||||
organizationSettings?.orgAutoAcceptEmail || existingOrg.organizationSettings?.orgAutoAcceptEmail,
|
||||
isAdminAPIEnabled:
|
||||
!!organizationSettings?.isAdminAPIEnabled ??
|
||||
!!existingOrg.organizationSettings?.isAdminAPIEnabled,
|
||||
isAdminAPIEnabled: !!(
|
||||
organizationSettings?.isAdminAPIEnabled ?? existingOrg.organizationSettings?.isAdminAPIEnabled
|
||||
),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,10 +10,6 @@
|
||||
"@calcom/features/*": ["../features/*"],
|
||||
"@calcom/lib": ["../lib"],
|
||||
"@calcom/lib/*": ["../lib/*"],
|
||||
"@calcom/platform-constants": ["../platform/constants/index.ts"],
|
||||
"@calcom/platform-enums": ["../platform/enums/index.ts"],
|
||||
"@calcom/platform-types": ["../platform/types/index.ts"],
|
||||
"@calcom/platform-utils": ["../platform/utils/index.ts"],
|
||||
"@calcom/prisma": ["../prisma"],
|
||||
"@calcom/prisma/*": ["../prisma/*"],
|
||||
"@calcom/repository/*": ["../lib/server/repository/*"]
|
||||
|
||||
@@ -62,7 +62,7 @@ export function CreateButton(props: CreateBtnProps) {
|
||||
|
||||
// inject selection data into url for correct router history
|
||||
const openModal = (option: Option) => {
|
||||
const _searchParams = new URLSearchParams(searchParams ?? undefined);
|
||||
const _searchParams = new URLSearchParams(searchParams.toString());
|
||||
function setParamsIfDefined(key: string, value: string | number | boolean | null | undefined) {
|
||||
if (value !== undefined && value !== null) _searchParams.set(key, value.toString());
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ function WebDialog(props: DialogProps) {
|
||||
const router = useRouter();
|
||||
const pathname = usePathname();
|
||||
const searchParams = useCompatSearchParams();
|
||||
const newSearchParams = new URLSearchParams(searchParams ?? undefined);
|
||||
const newSearchParams = new URLSearchParams(searchParams.toString());
|
||||
const { children, name, ...dialogProps } = props;
|
||||
|
||||
// only used if name is set
|
||||
|
||||
Reference in New Issue
Block a user