{"id":5406,"date":"2023-01-05T12:37:14","date_gmt":"2023-01-05T04:37:14","guid":{"rendered":"https:\/\/badgameshow.com\/steven\/?p=5406"},"modified":"2023-01-05T12:37:14","modified_gmt":"2023-01-05T04:37:14","slug":"%e4%ba%86%e8%a7%a3typescript%e4%b8%ad%e7%9a%84tuples%e5%8a%9f%e8%83%bd","status":"publish","type":"post","link":"https:\/\/badgameshow.com\/steven\/typescript\/%e4%ba%86%e8%a7%a3typescript%e4%b8%ad%e7%9a%84tuples%e5%8a%9f%e8%83%bd\/","title":{"rendered":"\u4e86\u89e3TypeScript\u4e2d\u7684Tuples\u529f\u80fd"},"content":{"rendered":"<p><meta name=\"keywords\" content=\"TypeScript, tuples\"><\/p>\n<h1>\u4f7f\u7528 TypeScript Tuples \u4f86\u5efa\u7acb\u8cc7\u6599\u7d50\u69cb<\/h1>\n<p>TypeScript \u662f\u4e00\u7a2e JavaScript \u7684\u8d85\u96c6\uff0c\u5b83\u63d0\u4f9b\u4e86\u66f4\u591a\u7684\u529f\u80fd\uff0c\u5176\u4e2d\u4e4b\u4e00\u5c31\u662f Tuples\u3002Tuples \u662f\u4e00\u7a2e\u8cc7\u6599\u7d50\u69cb\uff0c\u5b83\u53ef\u4ee5\u7528\u4f86\u5132\u5b58\u4e00\u7d44\u6709\u5e8f\u7684\u5143\u7d20\uff0c\u6bcf\u500b\u5143\u7d20\u53ef\u4ee5\u662f\u4e0d\u540c\u7684\u8cc7\u6599\u578b\u614b\u3002<\/p>\n<p><!--more--><\/p>\n<p>Tuples \u53ef\u4ee5\u7528\u4f86\u5efa\u7acb\u4e00\u500b\u6709\u5e8f\u7684\u8cc7\u6599\u7d50\u69cb\uff0c\u5b83\u53ef\u4ee5\u5132\u5b58\u591a\u7a2e\u4e0d\u540c\u7684\u8cc7\u6599\u578b\u614b\uff0c\u4f8b\u5982\u5b57\u4e32\u3001\u6578\u5b57\u3001\u5e03\u6797\u503c\u7b49\u7b49\u3002\u8209\u500b\u4f8b\u5b50\uff0c\u6211\u5011\u53ef\u4ee5\u5efa\u7acb\u4e00\u500b Tuples \u4f86\u5132\u5b58\u4e00\u500b\u4eba\u7684\u57fa\u672c\u8cc7\u6599\uff0c\u4f8b\u5982\u59d3\u540d\u3001\u5e74\u9f61\u3001\u6027\u5225\u7b49\u7b49\uff1a<\/p>\n<pre class=\"brush: typescript\">\nlet person: [string, number, boolean] = [\"John\", 25, true];\n<\/pre>\n<p>\u4e0a\u9762\u7684\u7a0b\u5f0f\u78bc\u5efa\u7acb\u4e86\u4e00\u500b Tuples\uff0c\u5b83\u5132\u5b58\u4e86\u4e00\u500b\u4eba\u7684\u57fa\u672c\u8cc7\u6599\uff0c\u5305\u62ec\u59d3\u540d\u3001\u5e74\u9f61\u3001\u6027\u5225\u3002Tuples \u7684\u5143\u7d20\u662f\u6709\u5e8f\u7684\uff0c\u6240\u4ee5\u6211\u5011\u53ef\u4ee5\u7528\u7d22\u5f15\u4f86\u5b58\u53d6\u5b83\u5011\uff1a<\/p>\n<pre class=\"brush: typescript\">\nlet name = person[0]; \/\/ John\nlet age = person[1]; \/\/ 25\nlet isMale = person[2]; \/\/ true\n<\/pre>\n<p>Tuples \u53ef\u4ee5\u7528\u4f86\u5efa\u7acb\u4e00\u500b\u6709\u5e8f\u7684\u8cc7\u6599\u7d50\u69cb\uff0c\u5b83\u53ef\u4ee5\u5132\u5b58\u591a\u7a2e\u4e0d\u540c\u7684\u8cc7\u6599\u578b\u614b\uff0c\u4e26\u4e14\u53ef\u4ee5\u7528\u7d22\u5f15\u4f86\u5b58\u53d6\u5b83\u5011\u3002\u4f7f\u7528 Tuples \u4f86\u5efa\u7acb\u8cc7\u6599\u7d50\u69cb\u53ef\u4ee5\u8b93\u6211\u5011\u66f4\u6709\u6548\u7387\u5730\u7ba1\u7406\u8cc7\u6599\uff0c\u4e5f\u53ef\u4ee5\u8b93\u6211\u5011\u66f4\u5bb9\u6613\u5730\u5c0d\u8cc7\u6599\u9032\u884c\u64cd\u4f5c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b78\u7fd2TypeScript\u4e2d\u7684Tuples\u529f\u80fd\uff0c\u53ef\u4ee5\u8b93\u4f60\u66f4\u6709\u6548\u7387\u5730\u5efa\u7acb\u548c\u7ba1\u7406\u8cc7\u6599\u7d50\u69cb\uff0c\u4e26\u66f4\u5bb9\u6613\u5730\u5c0d\u8cc7\u6599\u9032\u884c\u64cd\u4f5c\u3002\u672c\u6587\u5c07\u4ecb\u7d39Tuples\u7684\u57fa\u672c\u6982\u5ff5\uff0c\u4ee5\u53ca\u5982\u4f55\u4f7f\u7528\u5b83\u4f86\u5efa\u7acb\u548c\u7ba1\u7406\u8cc7\u6599\u7d50\u69cb\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[187],"tags":[186],"class_list":["post-5406","post","type-post","status-publish","format-standard","hentry","category-typescript","tag-typescript"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_shortlink":"https:\/\/wp.me\/pcFK27-1pc","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/5406","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/comments?post=5406"}],"version-history":[{"count":1,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/5406\/revisions"}],"predecessor-version":[{"id":5407,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/5406\/revisions\/5407"}],"wp:attachment":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/media?parent=5406"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/categories?post=5406"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/tags?post=5406"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}