I'm using aggregateApi to sum an amount but if there is no record, the sum amount is null even though the type says number
Int field called amountconst result = await prisma.disbursement.aggregate({ sum: { amount: true } })result.sum.amount is number. However, the value is null because there is no recordresult.sum.amount returns the sum amount correctlyThe return type should either return number | null and/or give us an option to coalesce null to 0
model Disbursement {
id Int @id @default(autoincrement())
amount Int
}
node:12.18.0-alpine3.11@prisma/cli : 2.5.1
Current platform : linux-musl
Query Engine : query-engine c88925ce44a9b89b4351aec85ba6a28979d2658e (at node_modules/@prisma/cli/query-engine-linux-musl)
Migration Engine : migration-engine-cli c88925ce44a9b89b4351aec85ba6a28979d2658e (at node_modules/@prisma/cli/migration-engine-linux-musl)
Introspection Engine : introspection-core c88925ce44a9b89b4351aec85ba6a28979d2658e (at node_modules/@prisma/cli/introspection-engine-linux-musl)
Format Binary : prisma-fmt c88925ce44a9b89b4351aec85ba6a28979d2658e (at node_modules/@prisma/cli/prisma-fmt-linux-musl)
Studio : 0.261.0
Preview Features : transactionApi
I can confirm this bug in dev build 2.6.0-dev.43. Thanks for reporting!

Will be in the 2.7 release. Dev build is 2.7.0-dev.14 onwards.
Most helpful comment
I can confirm this bug in dev build
2.6.0-dev.43. Thanks for reporting!