* refactor: Remove intervalLimits from @calcom/lib and export directly * Tackle other places that use parseBookingLimit/parseDurationLimit * More type fixups that were hidden by previous fails * Fixed up booking-limits file * Remove server-only
14 lines
439 B
TypeScript
14 lines
439 B
TypeScript
import { intervalLimitsType } from "./intervalLimitSchema";
|
|
import type { IntervalLimit } from "./intervalLimitSchema";
|
|
|
|
export function isBookingLimit(obj: unknown): obj is IntervalLimit {
|
|
return intervalLimitsType.safeParse(obj).success;
|
|
}
|
|
|
|
export function parseBookingLimit(obj: unknown): IntervalLimit | null {
|
|
let bookingLimit: IntervalLimit | null = null;
|
|
if (isBookingLimit(obj)) bookingLimit = obj;
|
|
|
|
return bookingLimit;
|
|
}
|