diff --git a/db/orm-defs.d.ts b/db/orm-defs.d.ts index e481f95..7484d76 100644 --- a/db/orm-defs.d.ts +++ b/db/orm-defs.d.ts @@ -114,3 +114,4 @@ export type AllKeys = U extends any ? keyof U : never export type PickTypeOf> = T extends { [k in K]?: any } ? T[K] : never export type Merge = {[x in AllKeys]: PickTypeOf} export type Nullable = {[k in keyof T]: T[k] | null} +export type Numberish = {[k in keyof T]: T[k] extends number ? (number | bigint) : T[k]} diff --git a/db/orm.js b/db/orm.js index 09e4bc7..601a7a0 100644 --- a/db/orm.js +++ b/db/orm.js @@ -8,7 +8,7 @@ const U = require("./orm-defs") * @template {keyof U.Models[Table]} Col * @param {Table} table * @param {Col[] | Col} cols - * @param {Partial} where + * @param {Partial>} where * @param {string} [e] */ function select(table, cols, where = {}, e = "") { @@ -108,7 +108,7 @@ class From { } /** - * @param {Partial} conditions + * @param {Partial>} conditions */ where(conditions) { const wheres = Object.entries(conditions).map(([col, value]) => { diff --git a/m2d/actions/redact.js b/m2d/actions/redact.js index 7569df4..ffbb261 100644 --- a/m2d/actions/redact.js +++ b/m2d/actions/redact.js @@ -25,7 +25,6 @@ async function deleteMessage(event) { */ async function removeReaction(event) { const hash = utils.getEventIDHash(event.redacts) - // TODO: this works but fix the type const row = from("reaction").join("message_channel", "message_id").select("channel_id", "message_id", "encoded_emoji").where({hashed_event_id: hash}).get() if (!row) return await discord.snow.channel.deleteReactionSelf(row.channel_id, row.message_id, row.encoded_emoji)