{"id":13305,"date":"2019-03-11T09:30:45","date_gmt":"2019-03-11T00:30:45","guid":{"rendered":"https:\/\/www.agent-grow.com\/self20percent\/?p=13305"},"modified":"2020-01-08T22:50:51","modified_gmt":"2020-01-08T13:50:51","slug":"typescript-paths-work-careful","status":"publish","type":"post","link":"https:\/\/www.agent-grow.com\/self20percent\/2019\/03\/11\/typescript-paths-work-careful\/","title":{"rendered":"TypeScript \u306e paths \u306f\u30d1\u30b9\u3092\u89e3\u6c7a\u3057\u3066\u304f\u308c\u306a\u3044\u306e\u3067\u6ce8\u610f\u3059\u3079\u3057\uff01"},"content":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f\u3001\u6c5f\u5d5c\u3067\u3059\u3002<\/p>\n<p>\u307f\u306a\u3055\u3093\u3001 TypeScript \u66f8\u3044\u3066\u307e\u3059\u304b\uff1f<\/p>\n<p>\u79c1\u306f JavaScript \u306e\u3086\u308b\u3075\u308f\u611f\u304c\u5927\u597d\u304d\u306a\u3093\u3067\u3059\u304c\u3001<br \/>\n\u3084\u3063\u3071\u308a\u305d\u3053\u305d\u3053\u306e\u5927\u304d\u3055\u306e\u3082\u306e\u3092\u958b\u767a\u3057\u3088\u3046\u3068\u601d\u3046\u3068<br \/>\n\u578b\u3068\u304b\u3042\u3063\u305f\u65b9\u304c\u5b89\u5fc3\u3067\u3001TypeScript \u3092\u4f7f\u304a\u3046\u304b\u306a\u3063\u3066\u6c17\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u3067\u3001\u4eca\u56de\u306f\u305d\u3093\u306a TypeScript \u3092\u4f7f\u3046\u4e0a\u3067\u6ce8\u610f\u3059\u3079\u304d\u5c0f\u30cd\u30bf\u7684\u304a\u8a71\u3092 1 \u70b9\u3002<br \/>\n(\u6587\u4e2d\u306e\u30b3\u30fc\u30c9\u306f\u4e00\u90e8\u5168\u89d2\u306b\u3057\u3066\u3044\u308b\u306e\u3067\u5b9f\u884c\u3055\u308c\u308b\u5834\u5408\u306f\u6ce8\u610f\u3057\u3066\u304f\u3060\u3055\u3044\u306d)<\/p>\n<h1>TypeScript \u306e paths \u3063\u3066\u8a2d\u5b9a\u4f7f\u3063\u3066\u307e\u3059\u304b\uff1f<\/h1>\n<p>TypeScript \u306f\u30b3\u30f3\u30d1\u30a4\u30eb\u306e\u30eb\u30fc\u30eb\u3092\u8272\u3005\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<br \/>\ntsconfig.json \u30d5\u30a1\u30a4\u30eb\u3067\u3059\u306d\uff01<br \/>\n\u591a\u5206\u4e00\u5ea6 TypeScript \u3092\u66f8\u304b\u308c\u305f\u65b9\u306a\u3089\u89e6\u3063\u305f\u3053\u3068\u304c\u3042\u308b\u306e\u3067\u306f\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u8272\u3005\u306a\u8a2d\u5b9a\u304c\u3067\u304d\u308b\u306e\u3067\u3059\u304c\u3001\u4eca\u56de\u306f\u305d\u306e\u4e2d\u3067\u3082<br \/>\n<code>paths<\/code> \u3068\u3044\u3046\u8a2d\u5b9a\u9805\u76ee\u306b\u3064\u3044\u3066\u3001\u898b\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<h1>\u2026\u3068\uff01\u305d\u306e\u524d\u306b\u3001\u4eca\u56de\u306e\u74b0\u5883\u3092\u6e96\u5099<\/h1>\n<p>\u3055\u3066\u3001\u3059\u3050\u306b\u3067\u3082 paths \u306e\u304a\u8a71\u3092\u3057\u3066\u3082\u3088\u3044\u306e\u3067\u3059\u304c\u3001<br \/>\n\u3053\u3053\u306f\u691c\u8a3c\u306e\u305f\u3081\u306e\u74b0\u5883\u3092\u7c21\u5358\u306b\u4f5c\u3063\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u3068\u308a\u3042\u3048\u305a\u3001\u3053\u3093\u306a\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u69cb\u6210\u3067\u2026<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ntest\n\u251c node_modules\n\u251c index.ts\n\u251c package.json\n\u2514 tsconfig.json\n<\/pre>\n<p>package.json \u306f\u3053\u3093\u306a\u611f\u3058\u3002<br \/>\n\u30b0\u30ed\u30fc\u30d0\u30eb\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u304c\u30a4\u30e4\u306a\u306e\u3067\u3001<br \/>\n<code>npm install --save-dev typescript<\/code> \u3067 typescript \u3060\u3051\u5165\u308c\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n{\n  \u201dname\u201d: \u201dtest\u201d,\n  \u201dversion\u201d: \u201d1.0.0\u201d,\n  \u201ddescription\u201d: \u201d\u201d,\n  \u201dmain\u201d: \u201dindex.js\u201d,\n  \u201dscripts\u201d: {\n    \u201dbuild\u201d: \u201dtsc -p tsconfig.json\u201d\n  },\n  \u201dauthor\u201d: \u201dezaki\u201d,\n  \u201dlicense\u201d: \u201dNo License\u201d,\n  \u201ddevDependencies\u201d: {\n    \u201dtypescript\u201d: \u201d^3.3.3333\u201d\n  }\n}\n<\/pre>\n<p>tsconfig.json \u306f\u3053\u3046\u3002<br \/>\n\u3053\u308c\u3082\u57fa\u672c\u7684\u306a\u8a2d\u5b9a\u3060\u3051\u3067\u7279\u306b\u4f55\u3063\u3066\u3053\u3068\u306f\u306a\u3044\u3067\u3059\u306d\u3002<br \/>\n\u3061\u306a\u307f\u306b\u4eca\u56de\u306f\u30b5\u30fc\u30d0\u30fc\u30b5\u30a4\u30c9\u3067\u4f7f\u3046\u3053\u3068\u3092\u60f3\u5b9a\u3057\u3066\u3044\u308b\u306e\u3067\u3001<br \/>\ntarget \u306f ES5 \u3058\u3083\u306a\u304f\u3066\u3082\u3044\u3044\u304b\u306a\u3068\u3044\u3046\u4e8b\u3067 <code>ESNext<\/code> \u3067\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n{\n  \u201dcompilerOptions\u201d: {\n    \u201dmodule\u201d: \u201dCommonJS\u201d,\n    \u201dtarget\u201d: \u201dESNext\u201d,\n    \u201dnoImplicitAny\u201d: true,\n    \u201drootDirs\u201d: &#x5B;\n      \u201d.\u201d\n    ],\n    \u201dmoduleResolution\u201d: \u201dNode\u201d,\n    \u201dsourceMap\u201d: true,\n    \u201dbaseUrl\u201d: \u201d.\u201d\n  },\n  \u201dinclude\u201d: &#x5B;\n    \u201d.\/**\/*\u201d\n  ],\n  \u201dexclude\u201d: &#x5B;\n    \u201d.\/node_modules\u201d\n  ]\n}\n<\/pre>\n<p>index.ts \u306f\u3068\u308a\u3042\u3048\u305a\u3053\u3046\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nconst hello = (name: string): void =\uff1e {\n  console.log(`Hello! ${name}`);\n};\n\nhello(\u2019AG\u2019);\n<\/pre>\n<p>JavaScript \u306b\u3001\u305f\u3060\u578b\u60c5\u5831\u3092\u4e0e\u3048\u305f\u3060\u3051\u3067\u3059\u306d\u3002<\/p>\n<p>\u3067\u306f\u3001\u30b3\u30f3\u30d1\u30a4\u30eb\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<br \/>\npackage.json \u306b build \u30b3\u30de\u30f3\u30c9\u3092\u4f5c\u3063\u3066\u304a\u3044\u305f\u306e\u3067\u3001<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nnpm run build\n<\/pre>\n<p>\u3067\u3044\u3044\u3067\u3059\u306d\u3002<\/p>\n<p>\u3053\u3093\u306a\u611f\u3058\u3067\u3001\u30d3\u30eb\u30c9\u3067\u304d\u307e\u3059\u3002<br \/>\n&lt;img src=\u201dhttps:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/03\/0d40a5e4a645fc6b96e767d64ac0878e.png\u201d alt=\u201d\u201d width=\u201d284\u201d height=\u201d77\u201d class=\u201dalignnone size-full wp-image-13306\u201d \/&gt;<\/p>\n<p>\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u5185\u306f\u3053\u3093\u306a\u611f\u3058<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ntest\n\u251c node_modules\n\u251c index.ts\n\u251c index.js\n\u251c index.js.map\n\u251c package.json\n\u2514 tsconfig.json\n<\/pre>\n<p><code>index.js<\/code> \u3068 <code>index.js.map<\/code> \u304c\u751f\u6210\u3055\u308c\u307e\u3057\u305f\u306d\u3002<br \/>\n\u3053\u308c\u3092 node \u30b3\u30de\u30f3\u30c9\u3067\u5b9f\u884c\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nnode index.js\n<\/pre>\n<p><img decoding=\"async\" src=\"\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/03\/2dbba63b65be5b241a1087c427d95864.png\u201d\" alt=\"\u201d\u201d\" width=\"\u201d258\u201d\" height=\"\u201d39\u201d\" class=\"\u201dalignnone\" \/><\/p>\n<p>\u306f\u3044\u3001\u60f3\u5b9a\u901a\u308a\u5b9f\u884c\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n<h1>paths \u3092\u4f7f\u3063\u3066\u307f\u308b<\/h1>\n<p>\u3053\u3053\u307e\u3067\u306f\u666e\u901a\u3067\u3059\u304b\u3089\u306d\uff01<br \/>\n\u3067\u306f\u3001\u672c\u984c\u306e paths \u3092\u4f7f\u3063\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u3053\u306e paths \u3068\u3044\u3046\u306e\u306f\u3001<a href=\"\/\/www.typescriptlang.org\/docs\/handbook\/compiler-options.html\u201d\" rel=\"\u201dnoopener noopener noreferrer\" target=\"\u201d_blank\u201d\">\u516c\u5f0f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<\/a>\u306e\u8aac\u660e\u3068\u3057\u3066\u306f<\/p>\n<blockquote><p>\n  List of path mapping entries for module names to locations relative to the baseUrl.\n<\/p><\/blockquote>\n<p>baseUrl \u304b\u3089\u306e\u30e2\u30b8\u30e5\u30fc\u30eb\u540d\u3078\u306e\u76f8\u5bfe\u30d1\u30b9\u30de\u30c3\u30d4\u30f3\u30b0\u3068\u3044\u3046\u3053\u3068\u3067\u3002<\/p>\n<p>\u3053\u308c\u3060\u3051\u3060\u3068\u826f\u304f\u308f\u304b\u3089\u3093\u306e\u3067\u5b9f\u4f8b\u3092\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3053\u3093\u306a\u69cb\u6210\u3060\u3063\u305f\u3068\u3057\u3066\u2026<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ntest\n\u251c node_modules\n\u251c index.ts\n\u251c package.json\n\u251c tsconfig.json\n\u2514 a\n\u3000 \u2514 b\n\u3000 \u3000 \u2514 c\n\u3000 \u3000 \u3000 \u2514 d\n\u3000 \u3000 \u3000 \u3000 \u2514 name.ts\n<\/pre>\n<p>index.ts \u306f name.ts \u306b\u4f9d\u5b58\u3057\u3066\u3044\u308b\u3068\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>name.ts \u306f\u3053\u3093\u306a\u611f\u3058<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nexport const MyName = \u2019AG\u2019;\n<\/pre>\n<p><code>MyName<\/code> \u3092 export \u3057\u3066\u308b\u3060\u3051\u3067\u3059\u306d\u3002<\/p>\n<p>\u3053\u308c\u306b\u5408\u308f\u305b\u3066\u3001 index.ts \u3082\u4fee\u6b63\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nimport { MyName } from \u2019.\/a\/b\/c\/d\/name\u2019;\n\nconst hello = (name: string): void =\uff1e {\n  console.log(`Hello! ${name}`);\n};\n\nhello(MyName);\n<\/pre>\n<p>\u5148\u7a0b\u540c\u69d8\u3001\u30d3\u30eb\u30c9\u3057\u3066\u5b9f\u884c\u3057\u3066\u307f\u308b\u3068\u3001\u540c\u3058\u3088\u3046\u306b \u201dHello! AG\u201d \u304c\u51fa\u529b\u3055\u308c\u307e\u3059\u3088\u306d\u3002<\/p>\n<p>\u826f\u304b\u3063\u305f\u826f\u304b\u3063\u305f\u2026\u306a\u306e\u3067\u3059\u304c\u3001<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nimport { MyName } from \u2019.\/a\/b\/c\/d\/name\u2019;\n<\/pre>\n<p>\u3053\u306e\u90e8\u5206\u9577\u304f\u306a\u3044\u3067\u3059\u304b\uff1f<\/p>\n<p>\u4eca\u56de\u307f\u305f\u3044\u306a\u30b1\u30fc\u30b9\u306a\u3089\u307e\u3060\u3044\u3044\u306e\u3067\u3059\u304c\u3001<br \/>\n<code>lib<\/code> \u307f\u305f\u3044\u306a\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u304c\u6d45\u3044\u968e\u5c64\u306b\u3042\u3063\u3066\u3001<br \/>\n\u8272\u3005\u306a\u6240\u304b\u3089<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nimport { MyName } from \u2019..\/..\/..\/..\/..\/..\/lib\u2019;\n<\/pre>\n<p>\u307f\u305f\u3044\u306b\u3059\u3054\u304f\u3055\u304b\u306e\u307c\u3063\u3066\u53c2\u7167\u3057\u306a\u3044\u3068\u3044\u3051\u306a\u3044\u3068\u304b\u2026<br \/>\n\u30a4\u30e4\u3067\u3059\u3088\u306d\uff01\u79c1\u306f\u30a4\u30e4\u3067\u3059\uff01<\/p>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u3053\u308c\u3092\u89e3\u6c7a\u3057\u3066\u304f\u308c\u308b\u306e\u304c\u3001\u3053\u306e paths \u3067\u3059\u3002<\/p>\n<p>\u3053\u3093\u306a\u611f\u3058\u3067 paths \u306e\u8a2d\u5b9a\u3092\u8ffd\u52a0\u3059\u308c\u3070\u3001<br \/>\nimport \u306e\u5bfe\u8c61\u3092\u30eb\u30fc\u30eb\u306b\u5f93\u3063\u3066\u8aad\u307f\u66ff\u3048\u3066\u304f\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n{\n  \u201dcompilerOptions\u201d: {\n    \u201dmodule\u201d: \u201dCommonJS\u201d,\n    \u201dtarget\u201d: \u201dESNext\u201d,\n    \u201dnoImplicitAny\u201d: true,\n    \u201drootDirs\u201d: &#x5B;\n      \u201d.\u201d\n    ],\n    \u201dmoduleResolution\u201d: \u201dNode\u201d,\n    \u201dsourceMap\u201d: true,\n    \u201dbaseUrl\u201d: \u201d.\u201d,\n    \u201dpaths\u201d: {\n      \u201d@\/*\u201d: &#x5B;\u201d.\/a\/b\/c\/d\/*\u201d],\n      \u201d@\u201d: &#x5B;\u201d.\/a\/b\/c\/d\u201d]\n    }\n  },\n  \u201dinclude\u201d: &#x5B;\n    \u201d.\/**\/*\u201d\n  ],\n  \u201dexclude\u201d: &#x5B;\n    \u201d.\/node_modules\u201d\n  ]\n}\n<\/pre>\n<p>\u4eca\u56de\u3001 <code>@\/*<\/code> \u3092\u8a2d\u5b9a\u3057\u307e\u3057\u305f\u3002<br \/>\n<code>*<\/code> \u306e\u90e8\u5206\u306f\u4efb\u610f\u306e\u6587\u5b57\u306a\u306e\u3067\u3001\u3061\u3087\u3046\u3069 <code>@\/<\/code> \u304c <code>.\/a\/b\/c\/d\/<\/code> \u3068\u5dee\u3057\u5909\u308f\u308b\u5f62\u3067\u3059\u306d\u3002<\/p>\n<p>\u3067\u306f\u3001\u3053\u308c\u306b\u5408\u308f\u305b\u3066\u3001 index.ts \u3082\u4fee\u6b63\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nimport { MyName } from \u2019@\/name\u2019;\n\nconst hello = (name: string): void =&amp;gt; {\n  console.log(`Hello! ${name}`);\n};\n\nhello(MyName);\n<\/pre>\n<p>\u30b9\u30c3\u30ad\u30ea\u3057\u307e\u3057\u305f\u306d\uff01<\/p>\n<p>\u3053\u3093\u306a\u611f\u3058\u3067\u3001\u3088\u304f\u4f7f\u3046\u30d1\u30b9\u3092\u7279\u5225\u306b\u8a2d\u5b9a\u3057\u3066\u304a\u304f\u3053\u3068\u3067\u3001<br \/>\n\u30ab\u30f3\u30bf\u30f3\u306b import \u3092\u66f8\u304f\u3053\u3068\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u3061\u306a\u307f\u306b\u3001 paths \u306e\u8a2d\u5b9a\u3092\u5916\u3057\u3066\u52d5\u304b\u3057\u3066\u307f\u308b\u3068\u2026<\/p>\n<p><img decoding=\"async\" src=\"\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/03\/0d40a5e4a645fc6b96e767d64ac0878e-1.png\u201d\" alt=\"\u201d\u201d\" width=\"\u201d352\u201d\" height=\"\u201d149\u201d\" class=\"\u201dalignnone\" \/><\/p>\n<p>\u300c@\/name \u3068\u3044\u3046\u30e2\u30b8\u30e5\u30fc\u30eb\u304c\u898b\u3064\u304b\u3089\u3093\u3088\u300d<br \/>\n\u3068\u30a8\u30e9\u30fc\u3092\u51fa\u3057\u3066\u304f\u308c\u307e\u3059\u3002<br \/>\nTypeScript \u306f\u3053\u3046\u3044\u3046\u611f\u3058\u3067\u3001\u5b58\u5728\u3057\u306a\u3044\u3082\u306e\u3092\u8a2d\u5b9a\u3057\u305f\u3068\u304d\u306b<br \/>\n\u304d\u3061\u3093\u3068\u30a8\u30e9\u30fc\u3092\u51fa\u3057\u3066\u304f\u308c\u308b\u3068\u3044\u3046\u306e\u304c\u3044\u3044\u3068\u3053\u308d\u3067\u3059\u306d\u3002<\/p>\n<h1>\u3067\u3082\u3053\u308c\u2026\u5b9f\u884c\u3067\u304d\u306a\u3044\uff1f<\/h1>\n<p>\u30ef\u30fc\u30a4\u30e4\u30c3\u30bf\u30fc\u30d9\u30f3\u30ea\u30fc\uff01\u306a\u3093\u3067\u3059\u304c\u3001<br \/>\n\u3053\u3053\u3067\u6b8b\u5ff5\u306a\u304a\u77e5\u3089\u305b\u3092\u4e00\u3064\u2026<\/p>\n<p>\u3053\u308c\u3001\u5b9f\u884c\u3067\u304d\u306a\u3044\u3093\u3067\u3059\u3002<\/p>\n<p>\u8a66\u3057\u306b\u5b9f\u884c\u3057\u3066\u307f\u308b\u3068\u2026<\/p>\n<p><img decoding=\"async\" src=\"\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/03\/0d40a5e4a645fc6b96e767d64ac0878e-2.png\u201d\" alt=\"\u201d\u201d\" width=\"\u201d481\u201d\" height=\"\u201d211\u201d\" class=\"\u201dalignnone\" \/><\/p>\n<p>\u3042\u308c\uff1f <code>@\/name<\/code> \u30e2\u30b8\u30e5\u30fc\u30eb\u304c\u7121\u3044\u3068\u8a00\u308f\u308c\u3066\u307e\u3059\u306d\u2026<\/p>\n<p>\u751f\u6210\u3055\u308c\u305f index.js \u3092\u898b\u3066\u307f\u308b\u3068\u2026<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n\u201duse strict\u201d;\nObject.defineProperty(exports, \u201d__esModule\u201d, { value: true });\nconst name_1 = require(\u201d@\/name\u201d);\nconst hello = (name) =&amp;gt; {\n    console.log(`Hello! ${name}`);\n};\nhello(name_1.MyName);\n\/\/# sourceMappingURL=index.js.map\n<\/pre>\n<p><code>require(\u201d@\/name\u201d)<\/code> \u3068\u3001\u30d1\u30b9\u304c <code>@\/<\/code> \u306e\u307e\u307e\u5165\u3063\u3066\u3044\u308b\u3067\u306f\u306a\u3044\u3067\u3059\u304b\uff01<br \/>\n\u89e3\u6c7a\u3057\u3066\u304f\u308c\u305f\u3093\u3058\u3083\u306a\u3044\u3093\u304b\u3044\uff01<\/p>\n<p>\u2026\u3068\u3001\u601d\u3044\u307e\u3059\u304c\u3001\u3053\u308c\u304c TypeScript \u306e\u4ed5\u69d8\u3067\u3059\u3002<br \/>\n\u3061\u306a\u307f\u306b\u3001\u4eca\u5f8c\u3082 typescript \u5074\u3067\u89e3\u6c7a\u306f\u3057\u3066\u304f\u308c\u308b\u3088\u3046\u306b\u306f\u306a\u3089\u306a\u3055\u305d\u3046\u3067\u3059\u3002<\/p>\n<p>\u3053\u306e\u8fba\u308a\u306e\u7d4c\u7def\u306f typescript \u306e GitHub issue \u3067<br \/>\n<a href=\"\/\/github.com\/Microsoft\/TypeScript\/issues\/10866\u201d\" rel=\"\u201dnoopener noopener noreferrer\" target=\"\u201d_blank\u201d\">https:\/\/github.com\/Microsoft\/TypeScript\/issues\/10866<\/a><br \/>\n\u3053\u3093\u306a\u611f\u3058\u3067\u8b70\u8ad6\u3055\u308c\u3066\u3044\u307e\u3057\u305f\u304c\u3001\u6700\u8fd1\u3001\u8b70\u8ad6\u3092\u30ed\u30c3\u30af\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n<p>\u6700\u7d42\u7684\u306a\u7d50\u8ad6\u3068\u3057\u3066\u306f\u3001<br \/>\n\u300cimport \u306e\u30d1\u30b9\u89e3\u6c7a\u306f TypeScript \u306e\u8cac\u52d9\u3058\u3083\u306a\u3044\u304b\u3089\uff01\u300d<br \/>\n\u3068\u3044\u3046\u4e8b\u307f\u305f\u3044\u3067\u3059\u3002<\/p>\n<p>\u78ba\u304b\u306b\u3001 TypeScript \u3068\u3057\u3066\u306f\u30d5\u30a1\u30a4\u30eb\u304c\u3042\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3066\u304f\u308c\u308c\u3070\u3044\u3044\u308f\u3051\u3067\u3001<br \/>\nJavaScript \u306b\u30b3\u30f3\u30d1\u30a4\u30eb\u3057\u305f\u5f8c\u306e\u30d1\u30b9\u89e3\u6c7a\u306f TypeScript \u306e\u3084\u308b\u3053\u3068\u3067\u306f\u306a\u3044\u3068\u3002<br \/>\n\u30c9\u6b63\u8ad6\u3067\u3057\u305f\u306d\u2026<\/p>\n<p>\u3067\u306f\u3001\u3069\u3046\u3059\u308b\u306e\u304b\u3001\u3068\u3044\u3046\u3068\u3001<br \/>\n\u300cwebpack \u3068\u304b\u3001\u305d\u3046\u3044\u3046\u30d1\u30b9\u89e3\u6c7a\u3055\u305b\u308b\u305f\u3081\u306e\u30e4\u30c4\u306b\u3084\u3089\u305b\u306a\u3055\u3044\u300d<br \/>\n\u3068\u3044\u3046\u4e8b\u307f\u305f\u3044\u3067\u3059\u3002<\/p>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u305d\u3046\u3057\u307e\u3057\u3087\u3046\u304b\u3002<\/p>\n<p><code>npm install --save-dev webpack webpack-cli ts-loader<\/code> \u3067<br \/>\nwebpack \u3068 typescript \u3092 webpack \u304b\u3089\u4f7f\u3046\u305f\u3081\u306e loader \u3092\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u3001<br \/>\nwebpack.config.js \u3092\u3053\u3093\u306a\u611f\u3058\u3067\u30eb\u30fc\u30c8\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u4f5c\u3063\u3068\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nconst path = require(\u2019path\u2019);\n\nmodule.exports = {\n  mode: \u2019development\u2019,\n  entry: path.resolve(__dirname, \u2019index.ts\u2019),\n  output: {\n    path: path.resolve(__dirname),\n    filename: \u2019main.js\u2019,\n  },\n  resolve: {\n    extensions: &#x5B;\u2019.ts\u2019],\n    alias: {\n      \u2019@\u2019: path.resolve(__dirname, \u2019a\/b\/c\/d\u2019),\n    },\n  },\n  target: \u2019node\u2019,\n  module: {\n    rules: &#x5B;\n      {\n        test: \/\\.ts$\/,\n        exclude: \/node_modules\/,\n        use: {\n          loader: \u2019ts-loader\u2019,\n          options: {\n            configFile: path.resolve(__dirname, \u2019tsconfig.json\u2019),\n          },\n        },\n      },\n    ],\n  },\n};\n<\/pre>\n<p>\u5f8c\u306f package.json \u306e \u201dbuild\u201d \u306e\u6240\u3092\u3001<br \/>\n\u201dtsc -p tsconfig.json\u201d \u304b\u3089 \u201dwebpack\u201d \u306b\u5909\u3048\u3066\u2026<\/p>\n<p><img decoding=\"async\" src=\"\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/03\/0d40a5e4a645fc6b96e767d64ac0878e-3.png\u201d\" alt=\"\u201d\u201d\" width=\"\u201d292\u201d\" height=\"\u201d216\u201d\" class=\"\u201dalignnone\" \/><\/p>\n<p>\u751f\u6210\u3055\u308c\u305f main.js \u3092\u5b9f\u884c\u3057\u3066\u307f\u308c\u3070\u3001<br \/>\n\u304d\u3061\u3093\u3068\u30d3\u30eb\u30c9\u3082\u5b9f\u884c\u3082\u3067\u304d\u3066\u3044\u307e\u3059\u306d\uff01<\/p>\n<h1>\u307e\u3068\u3081<\/h1>\n<p>TypeScript \u306b paths \u3068\u3044\u3046\u30aa\u30d7\u30b7\u30e7\u30f3\u304c\u3042\u308b\u306e\u3067\u3001<br \/>\n\u306a\u3093\u3068\u306a\u304f\u89e3\u6c7a\u307e\u3067\u3084\u3063\u3066\u304f\u308c\u305d\u3046\u306a\u30a4\u30e1\u30fc\u30b8\u3067\u3059\u304c\u3001<br \/>\nTypeScript \u306e\u8cac\u52d9\u3092\u8003\u3048\u308c\u3070\u305d\u3053\u307e\u3067\u3084\u3089\u306a\u3044\u3068\u3044\u3046\u306e\u3082\u5206\u304b\u308b\u8a71\u3067\u3059\u306d\u3002<\/p>\n<p>\u3061\u306a\u307f\u306b\u79c1\u306f<br \/>\n\u300c\u3069\u3053\u304b\u306b\u89e3\u6c7a\u307e\u3067\u3057\u3066\u304f\u308c\u308b\u30aa\u30d7\u30b7\u30e7\u30f3\u3068\u304b\u3042\u308b\u3093\u3058\u3083\u306d\u3047\u306e\uff01\u300d<br \/>\n\u3068\u601d\u3063\u3066 1 \u6642\u9593\u7a0b\u7121\u99c4\u306b\u3057\u307e\u3057\u305f\u3002\u3054\u5831\u544a\u307e\u3067\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f\u3001\u6c5f\u5d5c\u3067\u3059\u3002 \u307f\u306a\u3055\u3093\u3001 TypeScript \u66f8\u3044\u3066\u307e\u3059\u304b\uff1f \u79c1\u306f JavaScript \u306e\u3086\u308b\u3075\u308f\u611f\u304c\u5927\u597d\u304d\u306a\u3093\u3067\u3059\u304c\u3001 \u3084\u3063\u3071\u308a\u305d\u3053\u305d\u3053\u306e\u5927\u304d\u3055\u306e\u3082\u306e\u3092\u958b\u767a\u3057\u3088\u3046\u3068\u601d\u3046\u3068 \u578b\u3068\u304b\u3042\u3063\u305f\u65b9\u304c\u5b89\u5fc3\u3067\u3001Type [&hellip;]<\/p>\n","protected":false},"author":15,"featured_media":13313,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[587,10],"tags":[490],"class_list":["post-13305","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-pickup","category-tech","tag-typescript"],"jetpack_featured_media_url":"https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2019\/03\/850c7612116999490846136e772ab7fd.png","jetpack_shortlink":"https:\/\/wp.me\/p7Bq4F-3sB","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/posts\/13305","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/users\/15"}],"replies":[{"embeddable":true,"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/comments?post=13305"}],"version-history":[{"count":0,"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/posts\/13305\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/media\/13313"}],"wp:attachment":[{"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/media?parent=13305"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/categories?post=13305"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/tags?post=13305"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}