event.target here is an HTMLElement which is the parent of all HTML elements, but isn’t guaranteed to have the property value. TypeScript detects this and throws the error. Cast event.target to the appropriate HTML element to ensure it is HTMLInputElement which does have a value property:
(event.target as HTMLInputElement).value
Per the documentation:
Type the
$eventThe example above casts the
$eventas ananytype. That simplifies the code at a cost. There is no type information that could reveal properties of the event object and prevent silly mistakes.[…]
The
$eventis now a specificKeyboardEvent. Not all elements have avalueproperty so it caststargetto an input element.
(Emphasis mine)