SpinTheMic
Pro

Interview practice question

Accessing input value from event.target causes an error

Frontend Engineering · TypeScript · Beginner

In an input event handler, event.target.value gives a TypeScript error. Why, and how do you fix it?

What a strong answer covers

Your AI report card counts how many of these ideas you cover.

  • event.target typed as EventTarget (generic).
  • Use currentTarget with typed element.
  • Narrow with instanceof HTMLInputElement.
  • Typed event in frameworks (React.ChangeEvent).
  • Avoid blind assertions.
Practise this topic

Start without signing up. Sign in free to get an AI report card on your answer.

See all topics