Skip to content

Commit

Permalink
types for missing cost inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeh committed Dec 10, 2024
1 parent d680ce9 commit a1c1130
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
3 changes: 2 additions & 1 deletion api/src/modules/calculations/cost.calculator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
CostPlanMap,
CustomProjectCostDetails,
CustomProjectSummary,
OutputCostNames,
YearlyBreakdown,
} from '@shared/dtos/custom-projects/custom-project-output.dto';

Expand Down Expand Up @@ -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,
Expand Down
14 changes: 13 additions & 1 deletion shared/dtos/custom-projects/custom-project-output.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a1c1130

Please sign in to comment.