Reputation: 31
I have following code and get TS2345 error. I have used Angular 7.
let totalAmount = quantity*rate;
let discountAmount = totalAmount - (totalAmount*discount)/100;
let finalValue = parseFloat(discountAmount - (discountAmount - (discountAmount * (100/(100+tax))))).toFixed(2).toString();
taxableAmount.setValue(finalValue);
Upvotes: 2
Views: 936
Reputation: 5650
Can you remove the parseFloat
. parseFloat
expects a string as the argument but you're passing a number
,
let totalAmount = quantity * rate;
let discountAmount = totalAmount - (totalAmount * discount) / 100;
let finalValue = (
discountAmount -
(discountAmount - discountAmount * (100 / (100 + tax)))
)
.toFixed(2)
.toString();
Upvotes: 1