chargeCalculator() {
let amount = ((document.getElementById('amount') as HTMLInputElement).value);
let prescription = ((document.getElementById('prescription') as HTMLInputElement).value);
let vision = ((document.getElementById('vision') as HTMLInputElement).value);
let clinic = ((document.getElementById('clinic') as HTMLInputElement).value);
let dental = ((document.getElementById('dental') as HTMLInputElement).value);
let total = parseFloat(amount) + parseFloat(prescription) + parseFloat(vision) + parseFloat(clinic) + parseFloat(dental);
if (amount <= total) {
alert('Total amount should be less than ' + this.charge.amount);
return false;
}
This code is from my TypeScript file. It is functioning correctly but I am encountering an error during compilation.
The specific error message I am seeing is:
Error TS2365: Operator '<=' cannot be applied to types 'string' and 'number'.