type RecurrenceWeekday = "MO" | "TU" | "WE" | "TH" | "FR" | "SA" | "SU"; /** A nonempty selection of weekdays for a weekly recurrence. */ export type RecurrenceWeekdays = { [Day in RecurrenceWeekday]?: true; } & { [Day in RecurrenceWeekday]: Required, Day>>; }[RecurrenceWeekday]; export type MonthlyWeekdayOccurrence = "1st" | "2nd" | "3rd" | "4th" | "last"; export type MonthlyRecurrenceRestriction = | { type: "day_of_month"; day: number } | { type: "weekday_of_month"; weekday: RecurrenceWeekday; occurrence: MonthlyWeekdayOccurrence; }; export type RecurrenceScheduleEnd = | { type: "date"; endsAt: string } | { type: "occurrences"; count: number }; type RecurrenceScheduleBase = { interval: number; start: string; timeZone: string; end?: RecurrenceScheduleEnd; }; export type HourlyRecurrenceSchedule = RecurrenceScheduleBase & { frequency: "hour"; }; export type DailyRecurrenceSchedule = RecurrenceScheduleBase & { frequency: "day"; }; export type WeeklyRecurrenceSchedule = RecurrenceScheduleBase & { frequency: "week"; weekdays: RecurrenceWeekdays; }; export type MonthlyRecurrenceSchedule = RecurrenceScheduleBase & { frequency: "month"; monthlyRestriction: MonthlyRecurrenceRestriction; }; export type YearlyRecurrenceSchedule = RecurrenceScheduleBase & { frequency: "year"; }; export type RecurrenceSchedule = | HourlyRecurrenceSchedule | DailyRecurrenceSchedule | WeeklyRecurrenceSchedule | MonthlyRecurrenceSchedule | YearlyRecurrenceSchedule;