function Sum() { var Number1 = 0, Number2 = 0, sum = 0; var input: HTMLInputElement; input = <HTMLInputElement>document.getElementById("txtNumber1"); Number1 = parseFloat(input); input = <HTMLInputElement>document.getElementById("textNumber2"); Number2 = parseFloat(input); sum = Number1 + Number2; var txtNumberSum: HTMLParagraphElement; var txtNumberSum = <HTMLParagraphElement>document.getElementById("txtNumberSum"); txtNumberSum.innerHTML = sum; }
TypeScipt Code
Error code's Argument of type 'HTMLInputElement' is not assignable to parameter of type 'string'
Type 'number' is not assignable to type 'string
html Code
2.1m questions
2.1m answers
60 comments
57.0k users