From 254830f6a78032281b3832649c887eee1812214a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9B=90=EB=8D=94?= Date: Wed, 6 Jan 2021 09:38:33 +0900 Subject: [PATCH] types: fixed typing for nullable argument --- utils/Query.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/Query.ts b/utils/Query.ts index 41d5086..1e22298 100644 --- a/utils/Query.ts +++ b/utils/Query.ts @@ -23,7 +23,7 @@ export async function getBot(id: string, owners=true):Promise { res[0].category = JSON.parse(res[0].category) res[0].owners = JSON.parse(res[0].owners) if(owners) res[0].owners = res[0].owners.map(async (u: string) => await getUser(u)) - res[0].owners = await Promise.all(res[0].owners.filter((el: any)=> el)) + res[0].owners = await Promise.all(res[0].owners.filter((el: User|null)=> el)) res[0].vanity = res[0].vanity && ( res[0].boosted || res[0].trusted || res[0].partnered ) } @@ -37,7 +37,7 @@ export async function getUser(id: string, bots=true):Promise { const owned = await knex('bots').select(['id']).where('owners', 'like', `%${id}%`) if(bots) res[0].bots = owned.map(async b=> await getBot(b.id, false)) else res[0].bots = owned.map(async b=> b.id) - res[0].bots = await Promise.all(res[0].bots.filter(el=> el)) + res[0].bots = await Promise.all(res[0].bots.filter((el:Bot|null)=> el)) } return res[0] || null