The road to zero TypeScript errors (#1756)

* Type fixes

* Type fixes

* Type fixes

* Type fixes

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
Omar Lópezandkodiakhq[bot] authored and GitHub committed 2022-02-10 10:44:46 +00:00
1 parent 798930bf23
commit 5d0ba3dafc
14 files changed
+54 -53

No files matched your search

@@ -8,6 +8,7 @@ import { VideoCallData } from "@lib/videoClient";
import { NewCalendarEventType } from "../constants/types";
import { ConferenceData } from "./GoogleCalendar";
import type { Event } from "@lib/events/EventManager";
export type Person = {
name: string;
@@ -66,7 +67,7 @@ type EventBusyDate = Record<"start" | "end", Date | string>;
export interface Calendar {
createEvent(event: CalendarEvent): Promise<NewCalendarEventType>;
updateEvent(uid: string, event: CalendarEvent): Promise<unknown>;
updateEvent(uid: string, event: CalendarEvent): Promise<Event | Event[]>;
deleteEvent(uid: string, event: CalendarEvent): Promise<unknown>;
@@ -25,6 +25,7 @@ import { CALDAV_CALENDAR_TYPE } from "../constants/generals";
import { CalendarEventType, EventBusyDate, NewCalendarEventType } from "../constants/types";
import { Calendar, CalendarEvent, IntegrationCalendar } from "../interfaces/Calendar";
import { convertDate, getAttendees, getDuration } from "../utils/CalendarUtils";
import type { Event } from "@lib/events/EventManager";
dayjs.extend(utc);
dayjs.extend(timezone);
@@ -121,7 +122,7 @@ export default abstract class BaseCalendarService implements Calendar {
}
}
async updateEvent(uid: string, event: CalendarEvent): Promise<unknown> {
async updateEvent(uid: string, event: CalendarEvent) {
try {
const events = await this.getEventsByUID(uid);
@@ -141,7 +142,12 @@ export default abstract class BaseCalendarService implements Calendar {
if (error) {
this.log.debug("Error creating iCalString");
return {};
return {
type: event.type,
id: typeof event.uid === "string" ? event.uid : "-1",
password: "",
url: typeof event.location === "string" ? event.location : "-1",
};
}
const eventsToUpdate = events.filter((e) => e.uid === uid);
@@ -157,7 +163,7 @@ export default abstract class BaseCalendarService implements Calendar {
headers: this.headers,
});
})
);
).then((p) => p.map((r) => r.json() as unknown as Event));
} catch (reason) {
this.log.error(reason);