The DOM can be a bit tricky when it comes to typing. You never really know exactly what you're going to get, so you have to educate your codebase into what you know you're using. This is done using Type Assertion where TypeScript types know they're a certain type, but you give it additional information so you can access the properties and methods that you know will be available.
How to autocomplete jsdoc options?
Hey Navneet - The way you choose will depend on your project requirements, as well as in your preferences and needs. A good starting point is checking out this resource. Hope that helps!
I'm getting an error with:
const input = document.getElementById("input") as HTMLInputElement; input.autofocus = true;
telling me that "Property 'autofocus' does not exist on type 'HTMLInputElement'.ts(2339)"