The browser, typed
TypeScript knows every HTML element and event: an input has .value, a click has .clientX. It also knows querySelector might find nothing. Typed DOM code catches "null" crashes and typos in property names.
Element types
const input = document.querySelector<HTMLInputElement>("#name");
const out = document.querySelector("#out");
input?.addEventListener("input", (event) => {
const target = event.currentTarget as HTMLInputElement;
if (out) out.textContent = "Hello, " + target.value;
});