This seems to work:
handleKeywordKeyPress = (e: React.KeyboardEvent<FormControl>) =>{
if( e.key == 'Enter' ){
if( this.isFormValid() ){
this.handleCreateClicked();
}
}
};
The key(Ha ha) here, for me, was to specify React.KeyboardEvent, rather than KeyboardEvent.
Trolling around the React code, I was seeing definitions like:
type KeyboardEventHandler<T> = EventHandler<KeyboardEvent<T>>;
But didn’t realise that when I was copy/pasting KeyboardEvent as the parameter type for my handler, the compiler was actually picking up the KeyboardEvent which is some kind of default type defined in the Typescript libraries somewhere (rather than the React definition).