Fix TypeScript error: Property ‘keyCode’ does not exist on type ‘FormEvent’.

Fix:
Change type to React.KeyboardEvent:

onKeyUp(event: React.KeyboardEvent<object>)

Error:

Property 'keyCode' does not exist on type 'FormEvent<object>'.

This code triggers the error:

onKeyUp(event: React.FormEvent<object>) {
  event.preventDefault(); 

  if (event.keyCode === 13) {      
  }
}

Fixed:

onKeyUp(event: React.KeyboardEvent<object>) {
  event.preventDefault(); 

  if (event.keyCode === 13) {      
  }
}