mirror of
https://github.com/tomru/pfadi-bussle.git
synced 2026-03-04 23:17:12 +01:00
infer return type of functions
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import { MILAGE_TARIFS } from '../db/enums'
|
||||
import { AdditionalCost } from '../db/bill'
|
||||
|
||||
function roundToCent(amount: number) {
|
||||
function roundToCent(amount: number): number {
|
||||
return Math.round(amount * 100) / 100
|
||||
}
|
||||
|
||||
export function getMilageCosts(tarif: MILAGE_TARIFS, km: number): number {
|
||||
export function getMilageCosts({ tarif, km }: { tarif: MILAGE_TARIFS; km: number }): number {
|
||||
if (tarif === MILAGE_TARIFS.NOCHARGE) {
|
||||
return 0
|
||||
}
|
||||
@@ -56,7 +56,7 @@ export function getBillTotal({
|
||||
milage?: number
|
||||
additionalCosts: AdditionalCost[]
|
||||
}): number {
|
||||
const milageCosts = getMilageCosts(tarif, milage)
|
||||
const milageCosts = getMilageCosts({ tarif, km: milage })
|
||||
const additionalCostsSum = additionalCosts
|
||||
.map(({ value }) => value)
|
||||
.reduce((acc: number, value: number) => acc + value, 0)
|
||||
|
||||
Reference in New Issue
Block a user