diff --git a/server/src/modules/electoralOffice.ts b/server/src/modules/electoralOffice.ts index 609fb9ac..06101597 100644 --- a/server/src/modules/electoralOffice.ts +++ b/server/src/modules/electoralOffice.ts @@ -137,7 +137,7 @@ export async function createVote( }); } -export async function deleteVote(ctx: IAppContext, id: string) { +export async function deleteVote(ctx: IAppContext, id: string): Promise { const { knex, session } = ctx; assertRole(ctx, session.userSignature, "POLITICS"); return knex.transaction(async (trx) => { diff --git a/server/src/util/misc.ts b/server/src/util/misc.ts index 5ae25aa0..682e732e 100644 --- a/server/src/util/misc.ts +++ b/server/src/util/misc.ts @@ -109,7 +109,7 @@ export const compute = (f: () => T): T => f(); /** Apply a function if value is not null */ export const mapNullableC = (f: (_x: T) => U) => - (x: TNullable) => + (x: TNullable): TNullable => isNull(x) ? null : f(x); /* * Haskell-style logging functions * */ diff --git a/types.ts b/types.ts index c634f3fa..5eee24e4 100644 --- a/types.ts +++ b/types.ts @@ -213,7 +213,7 @@ export function inOperator( key: K, obj: O ): obj is O & Record { - return key in obj; + return typeof obj === "object" && obj !== null && key in obj; } export function checkPropertyType(