{"id":5275,"date":"2022-01-27T12:51:18","date_gmt":"2022-01-27T03:51:18","guid":{"rendered":"https:\/\/akamist.com\/blog\/?p=5275"},"modified":"2022-01-27T12:51:18","modified_gmt":"2022-01-27T03:51:18","slug":"reacttypescript%e3%81%a7%e3%80%81onkeypress%e3%82%a4%e3%83%99%e3%83%b3%e3%83%88%e3%81%ae%e5%9e%8b%e6%8c%87%e5%ae%9a%e3%82%92%e8%a1%8c%e3%81%86","status":"publish","type":"post","link":"https:\/\/akamist.com\/blog\/archives\/5275","title":{"rendered":"React+TypeScript\u3067\u3001onKeyPress\u30a4\u30d9\u30f3\u30c8\u306e\u578b\u6307\u5b9a\u3092\u884c\u3046"},"content":{"rendered":"<p>TypeScript\u3092\u4f7f\u3063\u3066React\u306e\u30b3\u30fc\u30c9\u3092\u66f8\u3044\u3066\u3044\u308b\u3068\u304d\u306b\u3001onKeyPress\u30a4\u30d9\u30f3\u30c8\u306b\u5bfe\u3059\u308b\u30a4\u30d9\u30f3\u30c8\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u578b\u6307\u5b9a\u65b9\u6cd5\u3067\u3059\u3002<\/p>\n<p>\u3053\u306e\u4f8b\u3067\u306f\u3001Input\u30bf\u30b0\u306b\u5bfe\u3059\u308b\u30ad\u30fc\u30dc\u30fc\u30c9\u30a4\u30d9\u30f3\u30c8\u3092\u51e6\u7406\u3057\u305f\u3044\u306e\u3067\u3001<code>React.KeyboardEvent&lt;HTMLInputElement&gt;<\/code>\u306e\u578b\u6307\u5b9a\u3092\u884c\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-js\">import React from 'react';\n\nconst Foo = () =&gt; {\n  const handleKeyPress = (e: React.KeyboardEvent&lt;HTMLInputElement&gt;) =&gt; {\n    ...\n  }\n\n  return (\n    &lt;input onKeyPress={(e) =&gt; handleKeyPress(e)} \/&gt;\n  );\n}\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>TypeScript\u3092\u4f7f\u3063\u3066React\u306e\u30b3\u30fc\u30c9\u3092\u66f8\u3044\u3066\u3044\u308b\u3068\u304d\u306b\u3001onKeyPress\u30a4\u30d9\u30f3\u30c8\u306b\u5bfe\u3059\u308b\u30a4\u30d9\u30f3\u30c8\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u578b\u6307\u5b9a\u65b9\u6cd5\u3067\u3059\u3002 \u3053\u306e\u4f8b\u3067\u306f\u3001Input\u30bf\u30b0\u306b\u5bfe\u3059\u308b\u30ad\u30fc\u30dc\u30fc\u30c9\u30a4\u30d9\u30f3\u30c8\u3092\u51e6\u7406\u3057\u305f\u3044\u306e\u3067\u3001Reac [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":4984,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[165],"tags":[308,254,302],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/akamist.com\/blog\/wp-content\/uploads\/2022\/01\/icon_react.png","jetpack-related-posts":[{"id":5301,"url":"https:\/\/akamist.com\/blog\/archives\/5301","url_meta":{"origin":5275,"position":0},"title":"TypeScript+React\u3067CSS\u306btextAlign\u3092\u4f7f\u3046\u3068\u304d\u306b\u30a8\u30e9\u30fc\u3092\u51fa\u3055\u306a\u3044","date":"2022\u5e741\u670831\u65e5","format":false,"excerpt":"## \u767a\u751f\u3057\u305f\u554f\u984c React\u306e\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3067textAlign\u306e\u30b9\u30bf\u30a4\u30eb\u3092\u9069\u7528\u3068\u3057\u305f\u3068\u3053\u308d\u3001\u30a8\u30e9\u2026","rel":"","context":"css","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":5249,"url":"https:\/\/akamist.com\/blog\/archives\/5249","url_meta":{"origin":5275,"position":1},"title":"[TypeScript] Object\u578b\u306elength\u3092\u53d6\u5f97\u3059\u308b\u3068TS2339\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3059\u308b","date":"2022\u5e741\u670825\u65e5","format":false,"excerpt":"## \u767a\u751f\u3057\u305f\u30a8\u30e9\u30fc TypeScript\u3067\u3001\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u578b\u306e\u5909\u6570\u306b\u5bfe\u3057\u3066length\u3092\u53d6\u5f97\u3057\u3088\u3046\u3068\u2026","rel":"","context":"\u672a\u5206\u985e","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/akamist.com\/blog\/wp-content\/uploads\/2022\/01\/icon_typescript.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":5188,"url":"https:\/\/akamist.com\/blog\/archives\/5188","url_meta":{"origin":5275,"position":2},"title":"\u30d5\u30a1\u30a4\u30eb\u306e\u982d\u306b\u300cimport React from 'react';\u300d\u3092\u66f8\u304f\u5fc5\u8981\u304c\u3042\u308b\u304b\u306b\u3064\u3044\u3066 (TS17004\u3001TS2686\u30a8\u30e9\u30fc)","date":"2022\u5e741\u670819\u65e5","format":false,"excerpt":"React\u306b\u95a2\u3059\u308b\u66f8\u7c4d\u30fbweb\u8a18\u4e8b\u3092\u898b\u3066\u3044\u308b\u3068\u3001\u5834\u5408\u3088\u3063\u3066\u306fjsx\/tsx\u30d5\u30a1\u30a4\u30eb\u306e\uff11\u884c\u76ee\u306b`imp\u2026","rel":"","context":"\u672a\u5206\u985e","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/akamist.com\/blog\/wp-content\/uploads\/2022\/01\/icon_react.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":5341,"url":"https:\/\/akamist.com\/blog\/archives\/5341","url_meta":{"origin":5275,"position":3},"title":"AWS CDK\u306eaws-ecs-patterns\u3067IAM\u30ed\u30fc\u30eb\u3092\u6307\u5b9a\u3059\u308b","date":"2022\u5e742\u670827\u65e5","format":false,"excerpt":"AWS\u306eCDK\u306ev2\u3067\u306f\u3001`aws_ecs_patterns`\u3068\u3044\u3046\u30e2\u30ce\u304c\u3001`aws-cdk-lib\u2026","rel":"","context":"aws","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":4988,"url":"https:\/\/akamist.com\/blog\/archives\/4988","url_meta":{"origin":5275,"position":4},"title":"create-react-app\u3067\u30ab\u30ec\u30f3\u30c8\u306bTypeScript\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210","date":"2022\u5e741\u67083\u65e5","format":false,"excerpt":"create-react-app\u3092\u4f7f\u3063\u3066TypeScript\u306eReact\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u3001\u30ab\u30ec\u30f3\u30c8\u30c7\u30a3\u2026","rel":"","context":"JavaScript","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/akamist.com\/blog\/wp-content\/uploads\/2022\/01\/icon_react.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":5528,"url":"https:\/\/akamist.com\/blog\/archives\/5528","url_meta":{"origin":5275,"position":5},"title":"TypeScript: eslint\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b","date":"2022\u5e745\u670828\u65e5","format":false,"excerpt":"React + TypeScript (craete-react-app\u306f\u672a\u4f7f\u7528)\u306e\u74b0\u5883\u306beslin\u2026","rel":"","context":"\u672a\u5206\u985e","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/posts\/5275"}],"collection":[{"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/comments?post=5275"}],"version-history":[{"count":2,"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/posts\/5275\/revisions"}],"predecessor-version":[{"id":5277,"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/posts\/5275\/revisions\/5277"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/media\/4984"}],"wp:attachment":[{"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/media?parent=5275"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/categories?post=5275"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/tags?post=5275"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}