I have the following code
const productPrices = orderBody.productIds.map(async (item) => {
const product = await prisma.product.findUnique({ where: { id: item }})
if (!product) return 0
return product.price
})
this gives me Promise<number>[]
I want to do this piece for summing all of the prices
const totalAmmount = productPrices.reduce( (count: number, input: number) => count + input )
but typescript is telling me you cant do that because it could be a nullish promise
so how can i make it work?