The following code:
<input
type="text"
onKeyPress={(e) => addTag(e)}
/>
const addTag = (e: React.SyntheticEvent<HTMLInputElement>): void => {
if (e.key === 'Enter')) {
// Do something with `e.currentTarget.value`
}
};
It results in this error:
Property 'key' does not exist on type 'SyntheticEvent<HTMLInputElement, Event>'.
How shall I type event here? Whatever I use must also work with e.currentTarget.value
.