const input = document.getElementById('input') as HTMLInputElement; function getValue(){ let value = input.value; } // then you apply this function to a button element in the HTML doc // <button onclick="getValue()">Get value</button>