mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 12:32:43 +00:00
test(medications): type the consumption stamp reduce accumulator
This commit is contained in:
1 parent
88763aaf7f
commit
dbb3f216d8
1 file changed
+4
-2
@@ -33,10 +33,12 @@ async function consumedUnits(
|
||||
});
|
||||
const stamp = row.inventoryConsumption;
|
||||
if (!Array.isArray(stamp)) return 0;
|
||||
return stamp.reduce(
|
||||
return stamp.reduce<number>(
|
||||
(sum, entry) =>
|
||||
sum +
|
||||
(entry && typeof (entry as { units?: unknown }).units === "number"
|
||||
(entry &&
|
||||
typeof entry === "object" &&
|
||||
typeof (entry as { units?: unknown }).units === "number"
|
||||
? (entry as { units: number }).units
|
||||
: 0),
|
||||
0,
|
||||
|
||||
Reference in new issue
Block a user