{"id":5484,"date":"2017-10-12T12:33:54","date_gmt":"2017-10-12T12:33:54","guid":{"rendered":"http:\/\/www.garysieling.com\/blog\/?p=5484"},"modified":"2017-10-12T12:33:54","modified_gmt":"2017-10-12T12:33:54","slug":"fix-typescript-error-property-keycode-not-exist-type-formevent","status":"publish","type":"post","link":"https:\/\/www.garysieling.com\/blog\/fix-typescript-error-property-keycode-not-exist-type-formevent\/","title":{"rendered":"Fix TypeScript error: Property &#8216;keyCode&#8217; does not exist on type &#8216;FormEvent&#8217;."},"content":{"rendered":"<p><b>Fix:<\/b><br \/>\nChange type to React.KeyboardEvent:<\/p>\n<pre lang=\"typescript\">\nonKeyUp(event: React.KeyboardEvent&lt;object>)\n<\/pre>\n<p><b>Error:<\/b><\/p>\n<pre>\nProperty 'keyCode' does not exist on type 'FormEvent&lt;object>'.\n<\/pre>\n<p><b>This code triggers the error:<\/b><\/p>\n<pre lang=\"typescript\">\nonKeyUp(event: React.FormEvent&lt;object>) {\n  event.preventDefault(); \n\n  if (event.keyCode === 13) {      \n  }\n}\n<\/pre>\n<p><b>Fixed:<\/b><\/p>\n<pre lang=\"typescript\">\nonKeyUp(event: React.KeyboardEvent&lt;object>) {\n  event.preventDefault(); \n\n  if (event.keyCode === 13) {      \n  }\n}\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Fix TypeScript error: Property &#8216;keyCode&#8217; does not exist on type &#8216;FormEvent<object>&#8216;.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[9],"tags":[302,557],"aioseo_notices":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/5484"}],"collection":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/comments?post=5484"}],"version-history":[{"count":0,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/5484\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/media?parent=5484"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/categories?post=5484"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/tags?post=5484"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}