The function works fine without the type declarations. As soon as I assign the types of variables, I get the errors:
Uncaught SyntaxError: Unexpected token ':', and: Uncaught ReferenceError: convertToCelcius is not defined at HTMLButtonElement.onclick (teamtree.html:15).
All I changed was assigning the variables their types and I'm not sure what these errors are referring to. My guess is some logical error passing the HTML input value (a string, right?) to the TS function as a string parameter.
The HTML looks as so:
<div class="main">
<input id="fahVal" name="fahVal" type="text" placeholder="Enter Fahrenheit Value"></input>
<button class="button" onclick='convertToCelcius(fahVal.value)'>Convert to Celcius</button>
</div>
And the TypeScript:
function convertToCelcius(fahVal: string) {
let celVal: number = (+fahVal - 32) * 5/9;
document.getElementById("display").innerHTML = `<h1> ${celVal.toFixed(0)} </h1>`;
}