{"id":6527,"date":"2020-04-01T15:00:56","date_gmt":"2020-04-01T06:00:56","guid":{"rendered":"https:\/\/blog.capilano-fw.com\/?p=6527"},"modified":"2020-04-02T04:02:57","modified_gmt":"2020-04-01T19:02:57","slug":"typescript%e3%81%ae%e5%9e%8b%e5%ae%a3%e8%a8%80%e3%83%bb%e5%85%a815%e5%ae%9f%e4%be%8b","status":"publish","type":"post","link":"https:\/\/blog.capilano-fw.com\/?p=6527","title":{"rendered":"TypeScript\u306e\u578b\u5ba3\u8a00\u30fb\u516815\u5b9f\u4f8b"},"content":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u524d\u56de\u8a18\u4e8b\u300c<a href=\"https:\/\/blog.capilano-fw.com\/?p=6460\">Laravel Mix\u3067TypeScript\u3092\u4f7f\u3046<\/a>\u300d\u3067\u306f\u3001\u3044\u307e\u5df7\u3067\u8a55\u5224\u304c\u3044\u3044<code>TypeScript<\/code>\u3092<code>Laravel<\/code>\u5185\u3067\u4f7f\u3046\u65b9\u6cd5\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3057\u305f\u3002<\/p>\n<p><code>TypeScript<\/code>\u306f\u30d3\u30eb\u30c9\u4f5c\u696d\u304c\u5fc5\u8981\u306b\u306a\u308b\u306e\u304c\u30cd\u30c3\u30af\u3067\u3059\u304c\u3001\u6b21\u306e<code>JavaScript<\/code>\u306e\u30e1\u30a4\u30f3\u30b9\u30c8\u30ea\u30fc\u30e0\u306b\u306a\u308b\u53ef\u80fd\u6027\u3082\u3042\u308b\u3068\u601d\u3044\u307e\u3059\u306e\u3067\u3001<strong>\u305b\u3081\u3066\u57fa\u672c\u3060\u3051\u306f\u4f53\u9a13\u3057\u3066\u304a\u304f\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002<\/strong><\/p>\n<p>\u305d\u3053\u3067\uff01<\/p>\n<p>\u4eca\u56de\u306f\u3001<code>TypeScript<\/code>\u306e\u57fa\u672c\u4e2d\u306e\u57fa\u672c\u3001<\/p>\n<p><strong style=\"font-size: 35px;\">\u578b\u306e\u5ba3\u8a00<\/strong><\/p>\n<p>\u3092\u5b9f\u4f8b\u3067\u307e\u3068\u3081\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p><span style=\"font-size: 1rem;\">\u305c\u3072<code>TypeScript<\/code>\u306e\u5165\u9580\u7de8\u3068\u3057\u3066\u4f7f\u3063\u3066\u3044\u305f\u3060\u3051\u308b\u3068\u5b09\u3057\u3044\u3067\u3059\ud83d\ude0a\u2728<\/span><\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3344 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_22.png\" alt=\"\" width=\"320\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_22.png 320w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_22-150x150.png 150w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_22-300x300.png 300w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_22-100x100.png 100w\" sizes=\"auto, (max-width: 320px) 100vw, 320px\" \/><br \/>\n<strong>\u300c\u578b\u306e\u5ba3\u8a00\u306f\u30a2\u30d7\u30ea\u958b\u767a\u3057\u3066\u4ee5\u6765\u2757<\/strong><strong>\u300d\u00a0<\/strong><\/p>\n<p><strong>\u958b\u767a\u74b0\u5883\uff1a<\/strong> TypeScript 3.8.3<\/p>\n<h1>\u6587\u5b57\u5217\u306e\u5ba3\u8a00<\/h1>\n<p>\u6587\u5b57\u5217\u3092\u4f7f\u3046\u5834\u5408\u3067\u3059\u3002<\/p>\n<h2>\u30b7\u30f3\u30b0\u30eb\u30af\u30a9\u30fc\u30c8\u306e\u5834\u5408<\/h2>\n<pre><strong>const str: string = '\u6587\u5b57\u5217\uff11';<\/strong><\/pre>\n<h2>\u30c0\u30d6\u30eb\u30af\u30a9\u30fc\u30c8\u306e\u5834\u5408<\/h2>\n<pre><strong>const str: string = \"\u6587\u5b57\u5217\uff12\";<\/strong><\/pre>\n<h2>\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u30fb\u30ea\u30c6\u30e9\u30eb\u306e\u5834\u5408<\/h2>\n<pre><strong>const name = '\u5c71\u7530\u592a\u90ce';<\/strong>\r\n<strong>const str: string = `${name}\u3055\u3093\u3001\u3053\u3093\u306b\u3061\u306f\uff01`;<\/strong><\/pre>\n<h2>\u6570\u5024\u304b\u3089\u5909\u63db\u3059\u308b\u5834\u5408<\/h2>\n<pre><strong>const num: number = 1;<\/strong>\r\n<strong>const str: string = num.toString();<\/strong><\/pre>\n<h2>\u771f\u507d\u5024\u304b\u3089\u5909\u63db\u3059\u308b\u5834\u5408<\/h2>\n<pre><strong>const bool = true;\r\nconst str: string = bool.toString();\r\n<\/strong><\/pre>\n<h2>\u914d\u5217\u30fb\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304b\u3089\u5909\u63db\u3059\u308b\u5834\u5408<\/h2>\n<pre><strong>const str: string = JSON.stringify([<\/strong><strong>'one', <\/strong><strong>'two', <\/strong><strong>'three'<\/strong><strong>]);<\/strong><\/pre>\n<h1>\u6570\u5024\u306e\u5ba3\u8a00<\/h1>\n<p>\u6570\u5024\u3092\u4f7f\u3046\u5834\u5408\u3067\u3059\u3002<\/p>\n<h2>10\u9032\u6570\u306e\u5834\u5408<\/h2>\n<pre><strong>const num: number = 10; <\/strong>\/\/ 10\u9032\u6570<\/pre>\n<h2>2\u9032\u6570\u306e\u5834\u5408<\/h2>\n<pre><strong>const num: number = 0b1010;<\/strong> \/\/ 2\u9032\u6570<\/pre>\n<h2>8\u9032\u6570\u306e\u5834\u5408<\/h2>\n<pre><strong>const num: number = 0o744; <\/strong>\/\/ 8\u9032\u6570<\/pre>\n<h2>16\u9032\u6570\u306e\u5834\u5408<\/h2>\n<pre><strong>const num: number = 0xf00d;<\/strong> \/\/ 16\u9032\u6570<\/pre>\n<h2>\u6587\u5b57\u5217\u304b\u3089\u5909\u63db\u3059\u308b\u5834\u5408<\/h2>\n<pre><strong>const str: string = '1';<\/strong>\r\n<strong>const num: number = parseInt(str);<\/strong><\/pre>\n<h1>\u771f\u507d\u5024\uff08true \/ false\uff09\u306e\u5ba3\u8a00<\/h1>\n<p>\u771f\u507d\u5024\uff08<code>true<\/code> \/ <code>false<\/code>\uff09\u3092\u4f7f\u3046\u5834\u5408\u3067\u3059\u3002<\/p>\n<h2>\u76f4\u63a5\u6307\u5b9a\u3059\u308b\u5834\u5408<\/h2>\n<pre><strong>const bool: boolean = true;<\/strong><\/pre>\n<h2>\u6587\u5b57\u5217\u304b\u3089\u5909\u63db\u3059\u308b\u5834\u5408<\/h2>\n<pre><strong>const str = 'true';<\/strong>\r\n<strong>const bool: boolean = (str === 'true');<\/strong><\/pre>\n<h2>\u6570\u5024\u304b\u3089\u5909\u63db\u3059\u308b\u5834\u5408<\/h2>\n<pre><strong>const num = 1;<\/strong>\r\n<strong>const bool: boolean = (num === 1);<\/strong><\/pre>\n<h1>\u914d\u5217<\/h1>\n<p>\u914d\u5217\u3092\u4f7f\u3046\u5834\u5408\u3067\u3059\u3002<\/p>\n<h2>\u6587\u5b57\u5217\u306e\u914d\u5217<\/h2>\n<pre><strong>const arr: string[] = ['\u6587\u5b57\u5217\uff11', '\u6587\u5b57\u5217\uff12', '\u6587\u5b57\u5217\uff13'];<\/strong><\/pre>\n<h2>\u6570\u5024\u306e\u914d\u5217<\/h2>\n<pre><strong>const arr: number[] = [1, 2, 3];<\/strong><\/pre>\n<h2>\u771f\u507d\u5024\uff08true \/ false\uff09\u306e\u914d\u5217<\/h2>\n<pre><strong>const arr: boolean[] = [true, false, true];<\/strong><\/pre>\n<h2>\u968e\u5c64\u304c\u6df1\u3044\u914d\u5217<\/h2>\n<pre><strong>const arr: string[][] = [ <\/strong>\/\/ \ud83d\udc48 \u30ab\u30c3\u30b3\u304c\uff12\u3064\r\n<strong>    ['\u6587\u5b57\u5217 1-1', '\u6587\u5b57\u5217 1-2', '\u6587\u5b57\u5217 1-3'],<\/strong>\r\n<strong>    ['\u6587\u5b57\u5217 2-1', '\u6587\u5b57\u5217 2-2', '\u6587\u5b57\u5217 2-3'],<\/strong>\r\n<strong>    ['\u6587\u5b57\u5217 3-1', '\u6587\u5b57\u5217 3-2', '\u6587\u5b57\u5217 3-3']<\/strong>\r\n<strong>];<\/strong><\/pre>\n<h1>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/h1>\n<p>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u4f7f\u3046\u5834\u5408\u3067\u3059\u3002<\/p>\n<pre><strong>const user: object = {<\/strong>\r\n<strong>    name: '\u5c71\u7530\u592a\u90ce',<\/strong>\r\n<strong>    age: 10,<\/strong>\r\n<strong>    hobbies: ['\u91ce\u7403', '\u30d4\u30a2\u30ce']<\/strong>\r\n<strong>};<\/strong><\/pre>\n<h1>Tuple\uff08\u30bf\u30d7\u30eb\uff09<\/h1>\n<p><code>TypeScript<\/code>\u306e<code>Tuple<\/code>\u306f\u3001\u7c21\u5358\u306b\u8a00\u3046\u3068<strong>\u578b\u3068\u30c7\u30fc\u30bf\u6570\u304c\u56fa\u5b9a\u3055\u308c\u305f\u914d\u5217\u3067\u3059\u3002<\/strong><\/p>\n<p>\u6b21\u306e\u4f8b\u306f\u3001\u300c\uff11\u3064\u76ee\u304c\u6587\u5b57\u5217\uff0f\uff12\u3064\u76ee\u304c\u6570\u5024\u300d\u306e\u30bf\u30d7\u30eb\u3067\u3059\u3002<\/p>\n<pre><strong>let user: [string, number] = ['\u5c71\u7530\u592a\u90ce', 20];<\/strong><\/pre>\n<p>\u306a\u304a\u3001<code>Python<\/code>\u306e<code>Tuple<\/code>\u3068\u306f\u9055\u3063\u3066<strong>\u5185\u5bb9\u306e\u5909\u66f4\u304c\u3067\u304d\u307e\u3059\u3002<\/strong><\/p>\n<pre><strong>let user: [string, number] = ['\u5c71\u7530\u592a\u90ce', 20];\r\nuser = ['\u4f50\u85e4\u6b21\u90ce', 25];<\/strong> \/\/ \ud83d\udc48 \u66f4\u65b0\u3067\u304d\u308b<\/pre>\n<p>\u307e\u305f\u3001\u968e\u5c64\u304c\u6df1\u3044\u5834\u5408\u306f\u6b21\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre><strong>const user: [string, string[]] = ['\u5c71\u7530\u592a\u90ce', ['\u91ce\u7403', '\u30d4\u30a2\u30ce']];<\/strong><\/pre>\n<h1>enum<\/h1>\n<p><code>enum<\/code>\u306f\u3001\u7c21\u5358\u306b\u8a00\u3046\u3068<strong>\u4f8b\u5916\u3092\u8a8d\u3081\u306a\u3044\u9078\u629e\u80a2\u3067\u3059\u3002<br \/>\n<\/strong>\u52d5\u7269\u3092\u4f7f\u3063\u305f\u4f8b\u3092\u898b\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre><strong>enum Animal { DOG, CAT, PANDA };<\/strong><\/pre>\n<p>\u3053\u306e\u5834\u5408\u3001\u5de6\u304b\u3089\u9806\u306b\u6570\u5024\u304c\u632f\u3089\u308c\u3001<\/p>\n<ul>\n<li>DOG\uff1a <strong>0<\/strong><\/li>\n<li>CAT\uff1a <strong>1<\/strong><\/li>\n<li>PANDA\uff1a <strong>2<\/strong><\/li>\n<\/ul>\n<p>\u3068\u306a\u308a\u3001\u30c7\u30fc\u30bf\u53d6\u5f97\u3092\u3059\u308b\u5834\u5408\u306f\u3053\u306e\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<pre>console.log(<strong>Animal.PANDA<\/strong>); \/\/ 2<\/pre>\n<p>\u306a\u304a\u3001\u5024\u3092\u72ec\u81ea\u306b\u6c7a\u3081\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre><strong>enum Animal { DOG = '\u72ac', CAT = '\u732b', PANDA = '\u30d1\u30f3\u30c0' };\r\nconsole.log(Animal.CAT);<\/strong> \/\/ \u732b\r\n<\/pre>\n<p>\u203b\u305f\u3060\u3057\u3001\u6570\u5024\u306fOK\u3067\u3059\u304c\u3001<code>true<\/code>\/<code>false<\/code>\u3084\u914d\u5217\u3001\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306f\u6307\u5b9a\u3067\u304d\u307e\u305b\u3093\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001\u91cd\u8981\u306a\u306e\u306f<code>Enum<\/code>\u306f<strong>\u5b58\u5728\u3057\u306a\u3044\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3057\u3088\u3046\u3068\u3059\u308b\u3068\u30a8\u30e9\u30fc\u306b\u306a\u308b\u70b9\u3067\u3059\u3002<\/strong><\/p>\n<pre>\/\/ \u26a0 \u3053\u308c\u306f\u30a8\u30e9\u30fc\u306b\u306a\u308a\u307e\u3059\r\n<strong>console.log(Animal.KOARA);<\/strong> \/\/ \ud83d\udc48 \u30b3\u30a2\u30e9\u306f\u5b58\u5728\u3057\u306a\u3044\u306e\u3067\u30a8\u30e9\u30fc<\/pre>\n<p><code>Enum<\/code>\u306e\u30e1\u30ea\u30c3\u30c8\u306f\u3053\u3053\u306b\u3042\u308a\u307e\u3059\u3002<br \/>\n\u3064\u307e\u308a\u3001<strong>\u60f3\u5b9a\u5916\u306e\u30c7\u30fc\u30bf\u304c\u5165\u3063\u3066\u3053\u306a\u3044\u306e\u3067\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u306b\u304f\u3044<\/strong>\u3068\u3044\u3046\u308f\u3051\u3067\u3059\u3002<\/p>\n<h1>any<\/h1>\n<p><code>any<\/code>\u306f\u3001\u3069\u3093\u306a\u578b\u3067\u3082\u53d7\u3051\u5165\u308cOK\u306a\u5f62\u5f0f\u3067\u3059\u3002<br \/>\n\u3064\u307e\u308a\u3001\u6587\u5b57\u5217\u3084\u6570\u5024\u3001\u771f\u507d\u5024\u3001\u914d\u5217\u3001\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306a\u3093\u3067\u3082\u683c\u7d0d\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre><strong>let value: any = '\u6587\u5b57\u5217';<\/strong>\r\n<strong>value = 2;<\/strong>\r\n<strong>value = ['\u914d\u5217 - 1', '\u914d\u5217 - 2'];<\/strong>\r\n<strong>value = { name: '\u30aa\u30d6\u30b8\u30a7\u30af\u30c8' };<\/strong><\/pre>\n<p>\u3082\u3061\u308d\u3093\u914d\u5217\u306b\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre><strong>let values: any[] = ['\u6587\u5b57\u5217', 1, true];\r\nconsole.log(values[0]);<\/strong> \/\/ \u6587\u5b57\u5217<\/pre>\n<h1>void<\/h1>\n<p><code>void<\/code>\u306f\u300c\u7a7a\u3063\u307d\u300d\u3068\u3044\u3046\u610f\u5473\u3067\u3001\u305d\u306e\u540d\u306e\u901a\u308a\u95a2\u6570\u306e\u8fd4\u308a\u5024\u304c\u5b58\u5728\u3057\u306a\u3044\u5834\u5408\u306a\u3069\u306b\u4f7f\u308f\u308c\u307e\u3059\u3002<\/p>\n<pre>function message(): <strong>void<\/strong> { \/\/ \ud83d\udc48 \u3053\u3053\r\n\r\n    console.log('\u8fd4\u308a\u5024\u306f\u3042\u308a\u307e\u305b\u3093\u3002');\r\n\r\n}\r\n\r\nmessage();<\/pre>\n<h1>null<\/h1>\n<p>\u5024\u304c<code>null<\/code>\u3060\u3051\u53d7\u3051\u5165\u308c\u308b\u578b\u3067\u3059\u3002<\/p>\n<pre><strong>let nullValue: null = null;\r\n\r\nnullValue = '\u6587\u5b57\u5217'; <\/strong>\/\/ \u26a0\u300cnull\u300d\u4ee5\u5916\u306f\u30a8\u30e9\u30fc\u306b\u306a\u308a\u307e\u3059\r\n<\/pre>\n<h1>undefined<\/h1>\n<p>\u5024\u304c<code>undefined<\/code>\u3060\u3051\u53d7\u3051\u5165\u308c\u308b\u578b\u3067\u3059\u3002<\/p>\n<pre><strong>let undefinedValue: undefined = undefined;\r\n\r\nundefinedValue = '\u6587\u5b57\u5217'; <\/strong>\/\/ \u26a0\u300cundefined\u300d\u4ee5\u5916\u306f\u30a8\u30e9\u30fc\u306b\u306a\u308a\u307e\u3059<\/pre>\n<h1>never<\/h1>\n<p><code>never<\/code>\u306f\u7279\u6b8a\u306a\u578b\u3067\u3001\u7c21\u5358\u306b\u8a00\u3046\u3068<strong>\u30b3\u30fc\u30c9\u304c\u6700\u5f8c\u307e\u3067\u305f\u3069\u308a\u7740\u304b\u306a\u3044\u5834\u5408\u306b\u4f7f\u308f\u308c\u307e\u3059\u3002<\/strong><\/p>\n<p>\u4f8b\u3092\u898b\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre><strong>function error(): never {<\/strong>\r\n\r\n<strong>    throw new Error('\u30b3\u30fc\u30c9\u306e\u6700\u5f8c\u307e\u3067\u884c\u304d\u307e\u305b\u3093');<\/strong>\r\n\r\n<strong>}<\/strong>\r\n\r\n<strong>error();<\/strong><\/pre>\n<p>\u3053\u306e\u5834\u5408\u3001\u30a8\u30e9\u30fc\u51e6\u7406\u304c\u767a\u751f\u3057\u30b3\u30fc\u30c9\u306f\u9014\u4e2d\u3067\u30b9\u30c8\u30c3\u30d7\u3057\u307e\u3059\u3002<br \/>\n\u305d\u306e\u305f\u3081\u3001<code>void<\/code>\u3068\u306f\u6839\u672c\u7684\u306b\u9055\u3046\u3082\u306e\u3067\u3042\u308b\u3053\u3068\u306b\u6ce8\u76ee\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<h1>Type assertion<\/h1>\n<p><code>TypeScript<\/code>\u3067\u3001\u4f8b\u5916\u7684\u306b\u30b3\u30f3\u30d1\u30a4\u30e9\u306b\u3088\u308b\u30c1\u30a7\u30c3\u30af\u3092\u3057\u306a\u3044\u3088\u3046\u306b\u3059\u308b\u6a5f\u80fd\u3067\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001\u6b21\u306e\u4f8b\u3092\u898b\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre>const str: any = '\u4e00\u4e8c\u4e09\u56db\u4e94';\r\nconst stringLength = <strong>(str as string)<\/strong>.length; \/\/ \ud83d\udc48 \u3053\u3053\r\nconsole.log(`\u6587\u5b57\u5217\u3068\u3057\u3066\u306e\u9577\u3055\u306f\u3001${stringLength}\u3067\u3059\u3002`);<\/pre>\n<p><code>(str as string)<\/code>\u306e\u90e8\u5206\u306f\u300c\u6587\u5b57\u5217\u3068\u3057\u3066\u52d5\u304b\u3057\u307e\u3059\u300d\u3068\u3044\u3046\u5ba3\u8a00\u3092\u3057\u3066\u3001<code>TypeScript<\/code>\u306b\u30c1\u30a7\u30c3\u30af\u306a\u3069\u306f\u4e0d\u8981\u3060\u3068\u3044\u3046\u3053\u3068\u3092\u4f1d\u3048\u3066\u3044\u307e\u3059\u3002\uff08\u3064\u307e\u308a\u3001\u300c\u6211\u3005\u304c\u3061\u3083\u3093\u3068\u30c1\u30a7\u30c3\u30af\u3092\u3057\u3066\u3044\u308b\u304b\u3089\u4efb\u305b\u3066\ud83d\ude09\u2728\u300d\u3068\u8a00\u3063\u3066\u3044\u308b\u308f\u3051\u3067\u3059\uff09<\/p>\n<h1>\u8907\u6570\u306e\u578b\u3092\u6307\u5b9a\u3059\u308b<\/h1>\n<p>\u4f8b\u3048\u3070\u3001\u6587\u5b57\u5217\u3068<code>null<\/code>\u306e\uff12\u3064\u304c\u6709\u52b9\u306b\u306a\u308b\u4f8b\u3092\u307f\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre><strong>let uid: string | null;<\/strong><\/pre>\n<p>\u3053\u306e\u5834\u5408\u3001<code>uid<\/code>\u306f\u6b21\u306e\u3088\u3046\u306b\u6587\u5b57\u5217\u304b<code>null<\/code>\u3069\u3061\u3089\u3082\u53d7\u3051\u5165\u308c\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre>let uid: string | null;\r\n\r\n\/\/ \ud83d\udc47 \u3069\u3061\u3089\u3067\u3082OK\r\nuid = null;\r\nuid = 'xxxxxxxxxxxx';<\/pre>\n<p>\u3082\u3061\u308d\u3093\u3001\u6587\u5b57\u5217\u3068<code>null<\/code>\u3060\u3051\u3067\u306a\u304f\u3001\u305d\u306e\u4ed6\u306e\u578b\u3082\u4f7f\u3048\u307e\u3059\u3002<\/p>\n<h1>Date, RegExp, Promise\u306a\u3069\u7279\u5b9a\u306e\u30af\u30e9\u30b9<\/h1>\n<pre><strong>const d: Date = new Date();<\/strong><\/pre>\n<pre><strong>const r: RegExp = new RegExp('[0-9]+');<\/strong><\/pre>\n<pre><strong>const p: Promise&lt;string&gt; = new Promise((resolve, reject) =&gt; {});<\/strong><\/pre>\n<h1>\u304a\u308f\u308a\u306b<\/h1>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u4eca\u56de\u306f<code>TypeScript<\/code>\u57fa\u672c\u306e\u57fa\u672c\u3001\u300c\u578b\u306e\u5ba3\u8a00\u300d\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3057\u305f\u3002\u5168\u4f53\u7684\u306b\u898b\u3066\u76f4\u611f\u7684\u3067\u7406\u89e3\u3057\u3084\u3059\u3044\u3093\u3058\u3083\u306a\u3044\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n<p>\u3061\u306a\u307f\u306b\u79c1\u304c\u3053\u306e\u4e2d\u3067\u6c17\u306b\u5165\u3063\u3066\u3044\u308b\u306e\u306f\u3001\u5217\u6319\u578b\u306e<code>enum<\/code>\u3067\u3059\u3002<br \/>\n\u3068\u3044\u3046\u306e\u3082\u3001<strong><code>enum<\/code>\u306f<code>Python<\/code>\u3067\u521d\u3081\u3066\u4f7f\u3063\u3066\u300c\u3053\u308c\u306f\u4fbf\u5229\u2757\u300d\u3068\u5b9f\u611f\u3057\u305f\u3053\u3068\u304c\u3042\u3063\u305f\u304b\u3089\u3067\u3059\u3002<\/strong><\/p>\n<p>\u306a\u304a\u3001\u578b\u3092\u5ba3\u8a00\u3059\u308b\u65b9\u5f0f\u306f<code>PHP 7.2<\/code>\u4ee5\u964d\u3067\u3082\u5c11\u3057\u305a\u3064\u8ffd\u52a0\u3055\u308c\u3066\u3044\u3063\u3066\u3044\u308b\u3088\u3046\u306a\u306e\u3067\u6700\u8fd1\u306e\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u306f\u540c\u3058\u65b9\u5411\u3092\u5411\u3044\u3066\u3044\u308b\u306e\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n<p>\u3068\u306f\u3044\u3048\u3001<code>PHP<\/code>\u3084<code>JavaScript<\/code>\u3067\u306f\u305d\u308c\u307b\u3069\u578b\u3092\u6c17\u306b\u3057\u306a\u304f\u3066\u3082\u30b3\u30fc\u30c9\u304c\u66f8\u3051\u308b\uff08\uff1d\u521d\u5fc3\u8005\u3067\u3082\u3068\u3063\u3064\u304d\u3084\u3059\u3044\uff09\u3068\u3044\u3046\u70b9\u3092\u8003\u3048\u308b\u3068\u3001\u4f7f\u3044\u305f\u3044\u4eba\u306f\u578b\u4f7f\u3046\u3068\u3044\u3046\u9078\u629e\u5f0f\u304c\u3044\u3044\u3068\u306f\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u305c\u3072\u6a5f\u4f1a\u304c\u3042\u3063\u305f\u3089\u4e00\u5ea6\u306f\u4f53\u9a13\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u306d\u3002<\/p>\n<p>\u3067\u306f\u3067\u306f\u301c\uff01<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3467 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_9.png\" alt=\"\" width=\"216\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_9.png 216w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_9-203x300.png 203w\" sizes=\"auto, (max-width: 216px) 100vw, 216px\" \/><\/p>\n<p style=\"text-align: center;\"><strong><span style=\"text-align: center; font-size: 1rem;\">\u300c\u305d\u3046\u3044\u3048\u3070\u3001\u6700\u8fd1<code>Python<\/code>\u89e6\u3063\u3066\u306a\u3044\u304b\u3089\u3001<br \/>\n<\/span><span style=\"text-align: center; font-size: 1rem;\"><code>function()<\/code>\u3063\u3066\u66f8\u3044\u3061\u3083\u3044\u305d\u3046<\/span><span style=\"text-align: center; font-size: 1rem;\">\ud83d\ude05\u300d<\/span><\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u524d\u56de\u8a18\u4e8b\u300cLaravel Mix\u3067TypeScript\u3092\u4f7f\u3046\u300d\u3067\u306f\u3001\u3044\u307e\u5df7\u3067\u8a55\u5224\u304c\u3044\u3044TypeScript\u3092Laravel\u5185\u3067\u4f7f\u3046\u65b9\u6cd5\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3057\u305f &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.capilano-fw.com\/?p=6527\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;TypeScript\u306e\u578b\u5ba3\u8a00\u30fb\u516815\u5b9f\u4f8b&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":6568,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[209],"class_list":["post-6527","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-javascript","tag-typescript"],"_links":{"self":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/6527","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6527"}],"version-history":[{"count":49,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/6527\/revisions"}],"predecessor-version":[{"id":6620,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/6527\/revisions\/6620"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/media\/6568"}],"wp:attachment":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6527"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6527"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6527"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}