I am trying to do some simple math with what should be a number returned from a request.ReponseText and a number entered into a textbox. Here is the code
//var storedMiles : number = new Number(request.responseText); var storedMiles = new Number(request.responseText); var enteredMiles = parseInt((<HTMLTextAreaElement>document.getElementById("txtMiles")).value); var intervalMiles = (enteredMiles - storedMiles);
The error that I am getting from the TypeScript compiler is:
The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
The compiler is putting the squiggly line under the
enteredMiles in the
var intervalMiles = (enteredMiles - storedMiles); line.
I wasn't able to find anything in the documentation about how to correct that error. Nor have I found a way to do the conversion myself. What is needed for the TypeScript compiler to treat both the
enteredMiles and the
storedMiles as the same "type" of number so I can do the math?