typescript doesn't know type of HTML element 1

typescript doesn’t know type of HTML element

const inputField = document.getElementById('sample') as HTMLInputElement;

const submitButton = document.getElementById('sampleButton') as HTMLButtonElement;

Here is what the above code is Doing:
1. We’re getting the input field and the submit button from the DOM.
2. We’re casting them to the appropriate type.

Similar Posts