The currentTarget vs target Distinction
What you'll learn: Why TypeScript gives you precise types for currentTarget but keeps target generic in React event handlers.
The Core Difference
When an event fires in React, you get two seemingly similar properties: event.currentTarget and event.target. TypeScript treats them very differently.
currentTarget is the element you attached the handler to. TypeScript knows exactly what this is because you wrote onClick={handler} on a specific JSX element. If you attached the handler to a <button>, currentTarget is typed as HTMLButtonElement.
target is the element that actually triggered the event. This could be the button itself, or it could be a child element inside the button (like a <span> or <Icon>). TypeScript can't predict what element the user will click on inside your component tree, so target is typed generically as EventTarget — not even an HTML element type!
The Analogy
Think of a mailbox on your porch. You installed it (currentTarget) at a specific location you know about. But the mail (target) could come from anyone — your neighbor, Amazon, or a random flyer distributor. You know where your mailbox is; you don't know who sent the mail until you check.
Practical Impact
function handleClick(e: React.MouseEvent<HTMLButtonElement>) {
e.currentTarget; // HTMLButtonElement ✓
e.target; // EventTarget (generic) ⚠️
}
You'll need type assertions or checks to use target safely, while currentTarget just works with autocomplete.
Key Takeaway: TypeScript types currentTarget precisely because it knows what element you attached the handler to, while target stays generic because the actual clicked element could be anything in the tree.