I liked the approach taught at https://www.pluralsight.com/guides/handling-multiple-inputs-with-single-onchange-handler-react but I'm having trouble converting it to TypeScript.
See the red-underline errors (such as Property 'checked' does not exist on type 'EventTarget & (HTMLTextAreaElement | HTMLInputElement)'.):
function handleChange(event: React.ChangeEvent<HTMLTextAreaElement | HTMLInputElement>) {
const thisField = event.target.name;
const value = event.target.type === 'checkbox' ? event.target.checked : event.target.value;
console.log(thisField, value);
setUser({
...user,
[thisField]: value,
});
}
What do I need to change about my types to resolve these errors?
