Skip to content

Commit

Permalink
feat: add return type for mortgageCalaculator
Browse files Browse the repository at this point in the history
  • Loading branch information
JDIZM committed Jan 29, 2024
1 parent 8defd90 commit 22bb368
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion calc/mortgageCalculator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const calcMortgageRepayment = (mortgage: MortgageOptions, principal: number): Mo

const calcInterestOnly = (mortgage: MortgageOptions, principal: number): InterestOnlyMortgageResult => {
const { homeValue, deposit, interestRate: rate, years } = mortgage;

// calculate the interest only payments
const interestPayments = calcInterestPayments(principal, rate, 12);

Expand All @@ -32,7 +33,10 @@ const calcInterestOnly = (mortgage: MortgageOptions, principal: number): Interes
};
};

export function mortgageCalculator(mortgage: MortgageOptions, type: MortgageType) {
export function mortgageCalculator(
mortgage: MortgageOptions,
type: MortgageType
): MortgageResult | InterestOnlyMortgageResult {
// The amount borrowed
const principal = mortgage.homeValue - mortgage.deposit;

Expand Down

0 comments on commit 22bb368

Please sign in to comment.