{"id":4994,"date":"2023-01-05T11:35:04","date_gmt":"2023-01-05T03:35:04","guid":{"rendered":"https:\/\/badgameshow.com\/steven\/?p=4994"},"modified":"2023-01-05T11:35:04","modified_gmt":"2023-01-05T03:35:04","slug":"%e4%ba%86%e8%a7%a3typescript%e7%b7%a8%e8%ad%af%e5%99%a8%e9%81%b8%e9%a0%85%e7%9a%84%e5%9f%ba%e6%9c%ac%e6%a6%82%e5%bf%b5","status":"publish","type":"post","link":"https:\/\/badgameshow.com\/steven\/typescript\/%e4%ba%86%e8%a7%a3typescript%e7%b7%a8%e8%ad%af%e5%99%a8%e9%81%b8%e9%a0%85%e7%9a%84%e5%9f%ba%e6%9c%ac%e6%a6%82%e5%bf%b5\/","title":{"rendered":"\u4e86\u89e3TypeScript\u7de8\u8b6f\u5668\u9078\u9805\u7684\u57fa\u672c\u6982\u5ff5"},"content":{"rendered":"<p><meta name=\"keywords\" content=\"TypeScript, Compiler Options\"><\/p>\n<p>TypeScript \u662f\u4e00\u7a2e JavaScript \u7684\u8d85\u96c6\uff0c\u5b83\u63d0\u4f9b\u4e86\u985e\u578b\u6aa2\u67e5\u548c\u5176\u4ed6\u529f\u80fd\uff0c\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u66f4\u5bb9\u6613\u5730\u958b\u767c\u5927\u578b\u61c9\u7528\u7a0b\u5f0f\u3002TypeScript \u7de8\u8b6f\u5668\u9078\u9805\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u66f4\u5bb9\u6613\u5730\u63a7\u5236\u7de8\u8b6f\u5668\u7684\u884c\u70ba\uff0c\u4ee5\u4fbf\u66f4\u597d\u5730\u7b26\u5408\u4ed6\u5011\u7684\u9700\u6c42\u3002<\/p>\n<h2>TypeScript \u7de8\u8b6f\u5668\u9078\u9805<\/h2>\n<p>TypeScript \u7de8\u8b6f\u5668\u9078\u9805\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u63a7\u5236\u7de8\u8b6f\u5668\u7684\u884c\u70ba\uff0c\u4ee5\u4fbf\u66f4\u597d\u5730\u7b26\u5408\u4ed6\u5011\u7684\u9700\u6c42\u3002\u4e0b\u9762\u662f\u4e00\u4e9b\u5e38\u898b\u7684 TypeScript \u7de8\u8b6f\u5668\u9078\u9805\uff1a<\/p>\n<ul>\n<li><strong>target<\/strong>\uff1a\u6307\u5b9a\u7de8\u8b6f\u5668\u7522\u751f\u7684 JavaScript \u7248\u672c\u3002\u53ef\u4ee5\u6307\u5b9a\u70ba ES3\u3001ES5\u3001ES2015 \u6216 ES2016\u3002<\/li>\n<li><strong>module<\/strong>\uff1a\u6307\u5b9a\u7de8\u8b6f\u5668\u7522\u751f\u7684 JavaScript \u6a21\u7d44\u7cfb\u7d71\u3002\u53ef\u4ee5\u6307\u5b9a\u70ba commonjs\u3001amd \u6216 system\u3002<\/li>\n<li><strong>sourceMap<\/strong>\uff1a\u6307\u5b9a\u662f\u5426\u7522\u751f source map \u6a94\u6848\u3002<\/li>\n<li><strong>noImplicitAny<\/strong>\uff1a\u6307\u5b9a\u662f\u5426\u5831\u544a\u96b1\u542b\u7684 any \u985e\u578b\u3002<\/li>\n<li><strong>noImplicitReturns<\/strong>\uff1a\u6307\u5b9a\u662f\u5426\u5831\u544a\u51fd\u5f0f\u4e2d\u6c92\u6709\u8fd4\u56de\u503c\u7684\u60c5\u6cc1\u3002<\/li>\n<li><strong>noImplicitThis<\/strong>\uff1a\u6307\u5b9a\u662f\u5426\u5831\u544a\u96b1\u542b\u7684 this \u985e\u578b\u3002<\/li>\n<li><strong>noUnusedLocals<\/strong>\uff1a\u6307\u5b9a\u662f\u5426\u5831\u544a\u51fd\u5f0f\u4e2d\u672a\u4f7f\u7528\u7684\u5c40\u90e8\u8b8a\u6578\u3002<\/li>\n<li><strong>noUnusedParameters<\/strong>\uff1a\u6307\u5b9a\u662f\u5426\u5831\u544a\u51fd\u5f0f\u4e2d\u672a\u4f7f\u7528\u7684\u53c3\u6578\u3002<\/li>\n<li><strong>strictNullChecks<\/strong>\uff1a\u6307\u5b9a\u662f\u5426\u555f\u7528\u5f37\u5236\u7684 null \u6aa2\u67e5\u3002<\/li>\n<li><strong>allowJs<\/strong>\uff1a\u6307\u5b9a\u662f\u5426\u5141\u8a31\u7de8\u8b6f JavaScript \u6a94\u6848\u3002<\/li>\n<li><strong>allowSyntheticDefaultImports<\/strong>\uff1a\u6307\u5b9a\u662f\u5426\u5141\u8a31\u5f9e\u6a21\u7d44\u4e2d\u532f\u5165\u672a\u5ba3\u544a\u7684\u8b8a\u6578\u3002<\/li>\n<li><strong>allowUnreachableCode<\/strong>\uff1a\u6307\u5b9a\u662f\u5426\u5141\u8a31\u57f7\u884c\u4e0d\u53ef\u5230\u9054\u7684\u7a0b\u5f0f\u78bc\u3002<\/li>\n<li><strong>allowUnusedLabels<\/strong>\uff1a\u6307\u5b9a\u662f\u5426\u5141\u8a31\u672a\u4f7f\u7528\u7684\u6a19\u7c64\u3002<\/li>\n<li><strong>noFallthroughCasesInSwitch<\/strong>\uff1a\u6307\u5b9a\u662f\u5426\u5831\u544a switch \u8a9e\u53e5\u4e2d\u7684 fallthrough \u932f\u8aa4\u3002<\/li>\n<li><strong>noEmitOnError<\/strong>\uff1a\u6307\u5b9a\u662f\u5426\u5728\u767c\u751f\u932f\u8aa4\u6642\u505c\u6b62\u7de8\u8b6f\u3002<\/li>\n<li><strong>noImplicitUseStrict<\/strong>\uff1a\u6307\u5b9a\u662f\u5426\u5831\u544a\u96b1\u542b\u7684 use strict \u6307\u4ee4\u3002<\/li>\n<li><strong>noImplicitReturns<\/strong>\uff1a\u6307\u5b9a\u662f\u5426\u5831\u544a\u51fd\u5f0f\u4e2d\u6c92\u6709\u8fd4\u56de\u503c\u7684\u60c5\u6cc1\u3002<\/li>\n<li><strong>noImplicitThis<\/strong>\uff1a\u6307\u5b9a\u662f\u5426\u5831\u544a\u96b1\u542b\u7684 this \u985e\u578b\u3002<\/li>\n<li><strong>noUnusedLocals<\/strong>\uff1a\u6307\u5b9a\u662f\u5426\u5831\u544a\u51fd\u5f0f\u4e2d\u672a\u4f7f\u7528\u7684\u5c40\u90e8\u8b8a\u6578\u3002<\/li>\n<li><strong>noUnusedParameters<\/strong>\uff1a\u6307\u5b9a\u662f\u5426\u5831\u544a\u51fd\u5f0f\u4e2d\u672a\u4f7f\u7528\u7684\u53c3\u6578\u3002<\/li>\n<li><strong>strictNullChecks<\/strong>\uff1a\u6307\u5b9a\u662f\u5426\u555f\u7528\u5f37\u5236\u7684 null \u6aa2\u67e5\u3002<\/li>\n<\/ul>\n<p><!--more--><\/p>\n<p>TypeScript \u7de8\u8b6f\u5668\u9078\u9805\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u66f4\u5bb9\u6613\u5730\u63a7\u5236\u7de8\u8b6f\u5668\u7684\u884c\u70ba\uff0c\u4ee5\u4fbf\u66f4\u597d\u5730\u7b26\u5408\u4ed6\u5011\u7684\u9700\u6c42\u3002\u5b83\u5011\u53ef\u4ee5\u7528\u4f86\u63a7\u5236\u7de8\u8b6f\u5668\u7522\u751f\u7684 JavaScript \u7248\u672c\u3001\u6a21\u7d44\u7cfb\u7d71\u3001source map \u6a94\u6848\u3001\u5831\u544a\u96b1\u542b\u7684\u985e\u578b\u3001\u5831\u544a\u51fd\u5f0f\u4e2d\u6c92\u6709\u8fd4\u56de\u503c\u7684\u60c5\u6cc1\u3001\u5831\u544a\u51fd\u5f0f\u4e2d\u672a\u4f7f\u7528\u7684\u5c40\u90e8\u8b8a\u6578\u548c\u53c3\u6578\u3001\u555f\u7528\u5f37\u5236\u7684 null \u6aa2\u67e5\u3001\u5141\u8a31\u7de8\u8b6f JavaScript \u6a94\u6848\u3001\u5141\u8a31\u5f9e\u6a21\u7d44\u4e2d\u532f\u5165\u672a\u5ba3\u544a\u7684\u8b8a\u6578\u3001\u5141\u8a31\u57f7\u884c\u4e0d\u53ef\u5230\u9054\u7684\u7a0b\u5f0f\u78bc\u3001\u5141\u8a31\u672a\u4f7f\u7528\u7684\u6a19\u7c64\u3001\u5831\u544a switch \u8a9e\u53e5\u4e2d\u7684 fallthrough \u932f\u8aa4\u3001\u5728\u767c\u751f\u932f\u8aa4\u6642\u505c\u6b62\u7de8\u8b6f\u3001\u5831\u544a\u96b1\u542b\u7684 use strict \u6307\u4ee4\u7b49\u7b49\u3002<\/p>\n<p>\u4f7f\u7528 TypeScript \u7de8\u8b6f\u5668\u9078\u9805\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u66f4\u5bb9\u6613\u5730\u63a7\u5236\u7de8\u8b6f\u5668\u7684\u884c\u70ba\uff0c\u4ee5\u4fbf\u66f4\u597d\u5730\u7b26\u5408\u4ed6\u5011\u7684\u9700\u6c42\u3002\u5b83\u5011\u53ef\u4ee5\u7528\u4f86\u63a7\u5236\u7de8\u8b6f\u5668\u7522\u751f\u7684 JavaScript \u7248\u672c\u3001\u6a21\u7d44\u7cfb\u7d71\u3001source map \u6a94\u6848\u3001\u5831\u544a\u96b1\u542b\u7684\u985e\u578b\u3001\u5831\u544a\u51fd\u5f0f\u4e2d\u6c92\u6709\u8fd4\u56de\u503c\u7684\u60c5\u6cc1\u3001\u5831\u544a\u51fd\u5f0f\u4e2d\u672a\u4f7f\u7528\u7684\u5c40\u90e8\u8b8a\u6578\u548c\u53c3\u6578\u3001\u555f\u7528\u5f37\u5236\u7684 null \u6aa2\u67e5\u3001\u5141\u8a31\u7de8\u8b6f JavaScript \u6a94\u6848\u3001\u5141\u8a31\u5f9e\u6a21\u7d44\u4e2d\u532f\u5165\u672a\u5ba3\u544a\u7684\u8b8a\u6578\u3001\u5141\u8a31\u57f7\u884c\u4e0d\u53ef\u5230\u9054\u7684\u7a0b\u5f0f\u78bc\u3001\u5141\u8a31\u672a\u4f7f\u7528\u7684\u6a19\u7c64\u3001\u5831\u544a switch \u8a9e\u53e5\u4e2d\u7684 fallthrough \u932f\u8aa4\u3001\u5728\u767c\u751f\u932f\u8aa4\u6642\u505c\u6b62\u7de8\u8b6f\u3001\u5831\u544a\u96b1\u542b\u7684 use strict \u6307\u4ee4\u7b49\u7b49\u3002\u4f7f\u7528\u9019\u4e9b\u9078\u9805\uff0c\u958b\u767c\u8005\u53ef\u4ee5\u66f4\u5bb9\u6613\u5730\u63a7\u5236\u7de8\u8b6f\u5668\u7684\u884c\u70ba\uff0c\u4ee5\u4fbf\u66f4\u597d\u5730\u7b26\u5408\u4ed6\u5011\u7684\u9700\u6c42\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6458\u8981:\u5728\u5b78\u7fd2TypeScript\u6642\uff0c\u4e86\u89e3\u7de8\u8b6f\u5668\u9078\u9805\u662f\u5f88\u91cd\u8981\u7684\uff0c\u5b83\u53ef\u4ee5\u5e6b\u52a9\u4f60\u66f4\u597d\u5730\u7406\u89e3TypeScript\u7684\u529f\u80fd\uff0c\u4e26\u66f4\u6709\u6548\u5730\u4f7f\u7528\u5b83\u3002\u672c\u6587\u5c07\u4ecb\u7d39TypeScript\u7de8\u8b6f\u5668\u9078\u9805\u7684\u57fa\u672c\u6982\u5ff5\uff0c\u5305\u62ec\u5b83\u5011\u7684\u529f\u80fd\u548c\u7528\u6cd5\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-4994","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-1iy","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/4994","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=4994"}],"version-history":[{"count":1,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/4994\/revisions"}],"predecessor-version":[{"id":4995,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/4994\/revisions\/4995"}],"wp:attachment":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/media?parent=4994"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/categories?post=4994"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/tags?post=4994"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}