From 793bbab022f2e7f9e1bc232b55b3af30421016f8 Mon Sep 17 00:00:00 2001 From: alexeh Date: Tue, 10 Dec 2024 08:51:00 +0100 Subject: [PATCH] types for missing cost inputs --- api/src/modules/calculations/cost.calculator.ts | 3 ++- .../custom-projects/custom-project-output.dto.ts | 14 +++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/api/src/modules/calculations/cost.calculator.ts b/api/src/modules/calculations/cost.calculator.ts index 1f0e594d..a25e17a9 100644 --- a/api/src/modules/calculations/cost.calculator.ts +++ b/api/src/modules/calculations/cost.calculator.ts @@ -17,6 +17,7 @@ import { CostPlanMap, CustomProjectCostDetails, CustomProjectSummary, + OutputCostNames, YearlyBreakdown, } from '@shared/dtos/custom-projects/custom-project-output.dto'; @@ -409,7 +410,7 @@ export class CostCalculator { const totalCost = sum(Object.values(costValues)); const totalNPV = this.calculateNpv(costValues, discountRate); yearlyBreakdown.push({ - costName: costName as keyof OverridableCostInputs, + costName: costName as keyof OverridableCostInputs & OutputCostNames, totalCost, totalNPV, costValues, diff --git a/shared/dtos/custom-projects/custom-project-output.dto.ts b/shared/dtos/custom-projects/custom-project-output.dto.ts index 31e1a494..2649e9d6 100644 --- a/shared/dtos/custom-projects/custom-project-output.dto.ts +++ b/shared/dtos/custom-projects/custom-project-output.dto.ts @@ -41,8 +41,20 @@ export type CustomProjectCostDetails = { longTermProjectOperatingCost: number; }; +export type OutputCostNames = [ + "opexTotalCostPlan", + "capexTotalCostPlan", + "totalCostPlan", + "estimatedRevenuePlan", + "creditsIssuedPlan", + "cumulativeNetIncomePlan", + "cumulativeNetIncomeCapexOpex", + "annualNetCashFlow", + "annualNetIncome", +]; + export type YearlyBreakdown = { - costName: keyof OverridableCostInputs; + costName: keyof OverridableCostInputs & OutputCostNames; totalCost: number; totalNPV: number; costValues: CostPlanMap;