Avatar ·

TypeScript Error: Property 'value' does not exist on type 'HTMLElement' when getting input value

Hello everyone! I just started learning TypeScript and encountered a very strange error that I can't understand. I have a simple HTML code with an input field and a button: ```html ``` In the TypeScript file, I want to get the value from the input when clicking the button: ```typescript const input = document.getElementById('username'); const button = document.getElementById('btn'); button.addEventListener('click', () => { const name = input.value; // Error! console.log(name); }); ``` But TypeScript throws an error: **"Property 'value' does not exist on type 'HTMLElement'."** I already checked — the element with id 'username' definitely exists in the HTML. In regular JavaScript, this code works without any issues.