{"id":5588,"date":"2014-11-12T02:51:19","date_gmt":"2014-11-11T17:51:19","guid":{"rendered":"http:\/\/www.webcyou.com\/?p=5588"},"modified":"2014-11-12T02:51:19","modified_gmt":"2014-11-11T17:51:19","slug":"typescript-%e3%82%92%e3%81%af%e3%81%98%e3%82%81%e3%82%8b%e6%99%82%e3%81%ae%e3%81%be%e3%81%a8%e3%82%81","status":"publish","type":"post","link":"https:\/\/www.webcyou.com\/?p=5588","title":{"rendered":"TypeScript \u3092\u306f\u3058\u3081\u308b\u6642\u306e\u307e\u3068\u3081"},"content":{"rendered":"<p>TypeScript\u3067\u5b9f\u88c5\u3092\u884c\u3063\u3066\u65e9\u534a\u5e74\u4ee5\u4e0a\u304c\u904e\u304e\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u3002\u3002\u3002<\/p>\n<p>\u81ea\u7531\u5954\u653e\u306bJavaScript\u3092\u66f8\u3044\u3066\u3044\u307e\u3057\u305f\u304c\u3001\u3059\u3063\u304b\u308a\u7e1b\u3089\u308c\u305f\u3044\u4f53\u3068\u306a\u3063\u3066\u3057\u307e\u3044\uff08\u5909\u306a\u65b9\u5411\u3060\u306a\u3002\uff09TypeScropt\u7121\u3057\u3067\u306f\u3082\u3046\u751f\u304d\u3089\u308c\u306a\u3044\u306e\u304b\uff1f \u3066\u3050\u3089\u3044\u3002\uff08\u3044\u3084\u5225\u306b\u7121\u3057\u3067\u3082\u5927\u4e08\u592b\u3060\u306a\u3002\uff09<\/p>\n<p>\u3068\u308a\u3042\u3048\u305a\u3001\u4eca\u304b\u3089TypeScript\u3092\u306f\u3058\u3081\u308b\uff01\u3063\u3066\u65b9\u3082\u3044\u308b\u304b\u3068\u601d\u3044\u307e\u3059\u306e\u3067\u3001\u4eca\u56de\u306fTypeScripe\u3092\u4e00\u901a\u308a\u307e\u3068\u3081\u3066\u307f\u308b\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u5c11\u3057\u3067\u3082\u53c2\u8003\u306b\u306a\u308c\u3070\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<h4>TypeScript\u3068\u306f<\/h4>\n<p>\u307e\u305a\u3001<strong>TypeScript<\/strong>\u3068\u306f\u306a\u3093\u305e\u3084\u3063\u3066\u3068\u3053\u308d\u304b\u3089\u3067\u3059\u304c\u3001<\/p>\n<p><strong>TypeScript<\/strong>\u306f\u30de\u30a4\u30af\u30ed\u30bd\u30d5\u30c8\u306b\u3088\u3063\u3066\u958b\u767a\u3055\u308c\u305f\u30d5\u30ea\u30fc\u3067\u30aa\u30fc\u30d7\u30f3\u30bd\u30fc\u30b9\u306e\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u3067\u3001\u300c<strong>CoffeeScript<\/strong>\u300d\u3084\u300c<strong>Haxe<\/strong>\u300d\u306a\u3069 A<strong>ltjs<\/strong>\u3068\u8a00\u308f\u308c\u308b\u7a2e\u985e\u3067\u6271\u308f\u308c\u3066\u304a\u308a\u307e\u3059\u3002<\/p>\n<p><strong>Altjs<\/strong>\u3068\u547c\u3070\u308c\u308b\u3082\u306e\u306f\u3001\u305d\u306e\u307e\u307e\u4f7f\u3046\u306e\u3067\u306f\u306a\u304f\u30b3\u30f3\u30d1\u30a4\u30eb\u3092\u884c\u3046\u3053\u3068\u306b\u3088\u3063\u3066Javascript\u306b\u5909\u63db\u3067\u304d\u308b\u8a00\u8a9e\u3067\u3001JavaScript\u306e\u8a00\u8a9e\u4ed5\u69d8\u304c\u96e3\u3057\u304f\u3001\u67d4\u8edf\u3059\u304e\u308b\u304c\u6545\u306b\u767a\u751f\u3059\u308b\u554f\u984c\u3092\u89e3\u6c7a\u3059\u308b\u3053\u3068\u306b\u7528\u3044\u3089\u308c\u308b\u8a00\u8a9e\u3068\u306a\u3063\u3066\u304a\u308a\u307e\u3059\u3002<\/p>\n<p><strong>TypeScript<\/strong>\u306e\u5927\u304d\u306a\u7279\u5fb4\u3068\u3057\u3066\u3001\u300c<strong>\u9759\u7684\u578b\u4ed8\u3051<\/strong>\u300d\u300c<strong>\u30af\u30e9\u30b9\u30d9\u30fc\u30b9\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u6307\u5411<\/strong>\u300d\u3092\u53d6\u308a\u5165\u308c\u305f\u8a00\u8a9e\u3068\u306a\u3063\u3066\u304a\u308a\u307e\u3059\u3002<\/p>\n<p>\u307e\u3001\u307e\u305a\u306f\u4f7f\u3063\u3066\u307f\u3088\u3046\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u304b\u3001\u3068\u8a00\u3046\u3053\u3068\u3067\u3001\u30d6\u30e9\u30a6\u30b6\u4e0a\u3067\u30c6\u30b9\u30c8\u304c\u884c\u3048\u308b<strong>TypeScript Playground<\/strong>\u306a\u308b\u3082\u306e\u304c\u3042\u308a\u307e\u3059\u306e\u3067\u3001\u89e6\u3063\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<h4>TypeScript Playground<\/h4>\n<p><strong>TypeScript Playground<\/strong><\/p>\n<p><a href=\"http:\/\/www.typescriptlang.org\/Playground\" target=\"_blank\">http:\/\/www.typescriptlang.org\/Playground<\/a><\/p>\n<p><a href=\"http:\/\/www.typescriptlang.org\/Playground\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/f0eb4e65fc6160c82f463d8b9b481e051.png\" alt=\"\" title=\"\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8 2014-11-09 23.48.49\" width=\"549\" height=\"320\" class=\"alignnone size-full wp-image-5590\" srcset=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/f0eb4e65fc6160c82f463d8b9b481e051.png 549w, https:\/\/www.webcyou.com\/wp-content\/uploads\/f0eb4e65fc6160c82f463d8b9b481e051-300x174.png 300w\" sizes=\"auto, (max-width: 549px) 100vw, 549px\" \/><\/a><\/p>\n<p>\u753b\u9762\u3092\u958b\u304f\u3068 \u5de6\u5074\u304c\u300c<strong>TypeScript<\/strong>\u300d \u53f3\u304c\u30b3\u30f3\u30d1\u30a4\u30eb\u5f8c\u306e\u300c<strong>JavaScript<\/strong>\u300d\u3068\u306a\u3063\u3066\u304a\u308a\u307e\u3059\u3002<\/p>\n<p>\u307e\u305a\u6700\u521d\u306b class Greeter { \u301c\u301c \u3068TypeScript\u3067\u8a18\u8ff0\u3055\u308c\u3066\u3044\u3066\u3001\u30b3\u30f3\u30d1\u30a4\u30eb\u5f8c\u306eJavaScript\u3067\u306f var Greeter = \u00a0(function() { \u301c\u301c \u3068\u306a\u3063\u3066\u3044\u308b\u306e\u304c\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><strong>JavaScript<\/strong>\u3067\u306f \u300c<strong>Class<\/strong>\u300d\u3068\u6982\u5ff5\u306f\u306a\u3044\u306e\u3067\u3059\u304c\u3001\u3053\u306e\u3088\u3046\u306b<strong>\u5373\u6642\u95a2\u6570\u3067\u30ab\u30d7\u30bb\u30eb\u5316<\/strong>\u3092\u884c\u3046\u3053\u3068\u306b\u3088\u3063\u3066<strong>Class\u307d\u304f\u6271\u3046\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u3002<\/strong><\/p>\n<p>\u3053\u3046\u3044\u3063\u305fJavaScript\u72ec\u81ea\u306e\u8a18\u8ff0\u3067\u53ef\u8aad\u6027\u3082\u3042\u307e\u308a\u826f\u304f\u306a\u3044\u306e\u3067\u3059\u304c\u3001TypeScript\u3092\u7528\u3044\u308b\u3053\u3068\u306b\u3088\u3063\u3066\u7d20\u76f4\u306b\u7f8e\u3057\u304f\u30af\u30e9\u30b9\u306b\u3088\u308b\u30ab\u30d7\u30bb\u30eb\u5316\u3092\u5b9f\u73fe\u3057\u3001\u554f\u984c\u3092\u89e3\u6c7a\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u3068\u306a\u3063\u3066\u304a\u308a\u307e\u3059\u3002<\/p>\n<p>\u307e\u305f\u3001greeting: string; \u306e\u3088\u3046\u306a\u578b\u6307\u5b9a\u3001constructor(message: string) { \u301c\u306e\u3088\u3046\u306b\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u306e\u5ba3\u8a00\u3082TypeScript\u306e\u7279\u5fb4\u3068\u8a00\u3048\u307e\u3059\u3002<\/p>\n<p>\u30bb\u30ec\u30af\u30c8\u3092 Modules\u306b\u5207\u308a\u66ff\u3048\u308b\u3068\u8868\u793a\u3059\u308b\u306e\u3067\u3059\u304c\u3001<\/p>\n<p><a href=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/50555e97461e8c0c3678d79527e62b4c.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/50555e97461e8c0c3678d79527e62b4c.png\" alt=\"\" title=\"\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8 2014-11-10 1.15.27\" width=\"188\" height=\"53\" class=\"alignnone size-full wp-image-5592\" \/><\/a><\/p>\n<p>module Sayings { \u301c\u306e\u3088\u3046\u306b<strong>module<\/strong>\u3082\u4f7f\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u3088\u3046\u306b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u6307\u5411\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u306e\u6838\u3068\u306a\u308b\u3001<\/p>\n<ul>\n<li><strong>\u30af\u30e9\u30b9<\/strong><\/li>\n<li><strong>\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30a4\u30b9<\/strong><\/li>\n<li><strong>\u30e2\u30b8\u30e5\u30fc\u30eb<\/strong><\/li>\n<\/ul>\n<p>\u7b49\u3092\u4f7f\u7528\u3067\u304d\u308b\u306e\u304c\u3001<strong>TypeScript\u306e\u7279\u5fb4\u3067\u3082\u3042\u308a\u307e\u3059\u3002<\/strong><\/p>\n<p>\u3067\u306f\u3001\u305d\u3093\u306a<strong>TypeScript<\/strong>\u306e\u30dd\u30a4\u30f3\u30c8\u3092\u63bb\u3044\u6458\u3093\u3067\u307e\u3068\u3081\u3066\u307f\u307e\u3059\u3002<\/p>\n<h4>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h4>\n<p>\u307e\u305a\u306f\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3002<\/p>\n<p>\u5148\u307b\u3069\u306e<strong>TypeScript Playground<\/strong>\u306f\u3001\u78ba\u8a8d\u7528\u3068\u3057\u3066\u4f7f\u3063\u3066\u3044\u305f\u3060\u3051\u308c\u3070\u3068\u3002<\/p>\n<p>\u5b9f\u969b\u306b\u306f\u4f5c\u696d\u3055\u308c\u308bPC\u306e\u30ed\u30fc\u30ab\u30eb\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u5229\u7528\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>Node.js\u306b\u4ed8\u5c5e\u3059\u308b\u30d1\u30c3\u30b1\u30fc\u30b8\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\u300cnpm\u300d\u3092\u4f7f\u3048\u3070\u7c21\u5358\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">npm install -g typescript<\/pre>\n<p>TypeScript\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u308b\u3068\u30b3\u30f3\u30d1\u30a4\u30e9\u3067\u3042\u308b\u300ctsc\u300d\u30b3\u30de\u30f3\u30c9\u304c\u4f7f\u7528\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u65e9\u901f\u3001TypeScripe\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><strong>hello.ts<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">class Greeter { \r\n    greeting: string; \r\n    constructor(message: string) { \r\n        this.greeting = message; \r\n    } \r\n    greet() { \r\n        return \"Hello, \" + this.greeting; \r\n    }\r\n}\r\nvar greeter = new Greeter(\"world\");console.log(greeter.greet());<\/pre>\n<p>TypeScripe\u30d5\u30a1\u30a4\u30eb\u306f.ts\u306e\u62e1\u5f35\u5b50\u3092\u6301\u3063\u305f\u30d5\u30a1\u30a4\u30eb\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u4f5c\u6210\u3057\u305f\u3089\u300ctsc\u300d\u30b3\u30de\u30f3\u30c9\u3067<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">tsc hello.ts<\/pre>\n<p>\u3059\u308b\u3068\u3001hello.js\u304c\u30b3\u30f3\u30d1\u30a4\u30eb\u3055\u308c\u307e\u3059\u306e\u3067node\u3067\u5b9f\u884c\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">node hello.js<\/pre>\n<p>\u3059\u308b\u3068\u3001\u300cHello, world\u300d\u3068\u8fd4\u3063\u3066\u304f\u308b\u304b\u3068\u601d\u3044\u307e\u3059\u3002\u3055\u3041\u59cb\u307e\u308a\u3067\u3059\uff01<\/p>\n<h4>\u5909\u6570<\/h4>\n<p>TypeScript\u3067\u306e\u5909\u6570\u306e\u5b9a\u7fa9\u306f\u300cvar \u5909\u6570\u540d: \u578b\u540d;\u300d\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">var v: any;\r\n\r\nv = 1;\r\n\r\nvar n: number = 1;<\/pre>\n<p>any\u306f\u4f55\u3067\u3082\u53d7\u3051\u5165\u308c\u308b\u305f\u3081\u3001JavaScript\u540c\u69d8\u3001\u6570\u5b57\u3067\u3082\u6587\u5b57\u5217\u3067\u3082\u4ee3\u5165\u304c\u53ef\u80fd\u3068\u306a\u3063\u3066\u304a\u308a\u307e\u3059\u3002<br \/>\n\u5b9a\u7fa9\u3057\u305f\u578b\u540d\u3068\u7570\u306a\u308b\u578b\u3092\u4ee3\u5165\u3057\u3088\u3046\u3068\u3059\u308b\u3068\u3001\u30b3\u30f3\u30d1\u30a4\u30eb\u30a8\u30e9\u30fc\u3068\u306a\u308a\u30b3\u30f3\u30d1\u30a4\u30eb\u306f\u884c\u308f\u308c\u307e\u305b\u3093\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">var n: number;\r\nn = 'webcyou';<\/pre>\n<p>\u4e0a\u8a18\u306e\u4ef6\u306f\u3001\u30b3\u30f3\u30d1\u30a4\u30eb\u30a8\u30e9\u30fc\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<h4>\u578b<\/h4>\n<h5>any<\/h5>\n<p>any\u578b\u306f\u6570\u5b57\u3067\u3082\u6587\u5b57\u5217\u3067\u3082\u4ee3\u5165\u304c\u53ef\u80fd\u3068\u306a\u3063\u3066\u3044\u3066\u3001<strong>\u4f55\u3067\u3082\u53d7\u3051\u5165\u308c\u308b\u578b<\/strong>\u3068\u306a\u3063\u3066\u304a\u308a\u307e\u3059\u3002<\/p>\n<p><strong>JavaSCript\u306f\u52d5\u7684\u578b\u4ed8\u3051\u306e\u8a00\u8a9e<\/strong>\u306a\u306e\u3067\u3001null\u3068undefined\u3092\u9664\u304d\u3001\u5909\u6570\u304c\u53c2\u7167\u3057\u3066\u3044\u308b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u3069\u3093\u306a\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304b\u306b\u95a2\u308f\u3089\u305a\u3001\u3069\u3093\u306a\u30d7\u30ed\u30d1\u30c6\u30a3\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u3082\u30a8\u30e9\u30fc\u3068\u306a\u3089\u305a\u3001\u5b58\u5728\u3057\u306a\u3044\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u8aad\u307f\u53d6\u308d\u3046\u3068\u3057\u3066\u3082\u3001\u5358\u306b<strong>undefined\u3068\u672a\u5b9a\u7fa9\u306e\u5024<\/strong>\u304c\u8fd4\u3063\u3066\u304f\u308b\u3060\u3051\u3067\u3059\u3002<\/p>\n<p>\u3053\u306e\u3088\u3046\u306a<strong>\u52d5\u7684\u578b\u4ed8\u3051\u8a00\u8a9e\u306e\u7279\u6709\u306e\u632f\u308b\u821e\u3044\u3092\u9632\u3050\u306e\u304c\u9759\u7684\u578b\u4ed8\u3051\u306e\u30e1\u30ea\u30c3\u30c8<\/strong>\u3067\u3059\u304c\u3001JavaScript\u306e\u30b9\u30fc\u30d1\u30fc\u30bb\u30c3\u30c8\u3068\u3057\u3066\u7528\u610f\u3055\u308c\u305fTypeScript\u3082<strong>JavaScript\u3068\u540c\u3058\u3088\u3046\u306b\u5909\u6570\u304c\u6271\u3048\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044<\/strong>\u305f\u3081\u3001\u300c<strong>any<\/strong>\u300d\u304c\u7528\u610f\u3055\u308c\u3066\u304a\u308a\u307e\u3059\u3002<\/p>\n<h5>\u30d7\u30ea\u30df\u30c6\u30a3\u30d6\uff08\u7d44\u307f\u8fbc\u307f\uff09\u578b<\/h5>\n<p>TypeScript\u3067\u306f\u3001\u30d7\u30ea\u30df\u30c6\u30a3\u30d6\u578b\u3068\u3057\u3066Number,\u00a0Boolean,\u00a0String,\u00a0Void,\u00a0Null,\u00a0Undefined\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u3053\u308c\u3089\u306e\u5ba3\u8a00\u306f\u5c0f\u6587\u5b57\u3092\u4f7f\u3063\u3066\u5ba3\u8a00\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">var b: boolean = \u00a0true;\r\nvar s: string = \"webcyou\";\r\nvar n: number = 1;<\/pre>\n<h5>void<\/h5>\n<p>void\u306f\u300c\u306a\u3044\u300d\u3053\u3068\u3092\u5ba3\u8a00\u3059\u308b\u578b\u3068\u306a\u3063\u3066\u3044\u3066\u3001<strong>null\u3068undefined\u306e\u307f\u304cvoid\u306e\u5024<\/strong>\u3068\u3057\u3066\u8a31\u5bb9\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\/\/\u8868\u793a\u306e\u76ee\u7684\u3067\u623b\u308a\u5024\u304c\u306a\u3044\u5834\u5408\u306e\u5ba3\u8a00<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">function hello(hoge: string): void {\r\n    console.log(\"webcyou\" + hoge);\r\n}\u00a0<\/pre>\n<h5>Object<\/h5>\n<p><strong>Object\u306f\u3059\u3079\u3066\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30d9\u30fc\u30b9<\/strong>\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u307e\u305f\u3001Object\u306f\u95a2\u6570toString\u3092\u5e38\u306b\u6301\u3063\u3066\u304a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">var objA: \r\nobject = true;\r\nvar objB: object = 1;\r\nvar objC: object = \"string\";\r\nconsole.log(objA.toString()); \/\/\u6587\u5b57\u5217\u3068\u3057\u3066true\u304c\u8fd4\u308b<\/pre>\n<h5>null\u3068undefined<\/h5>\n<p>null\u3068undefined\u306e\u5024\u306e\u578b\u306f\u300cany\u300d\u3068\u306a\u308b\u306e\u3067\u3001\u5168\u3066\u306e\u578b\u306e\u5909\u6570\u306b\u4ee3\u5165\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">var b: boolean = null;\r\n\r\nvar s: string = null;\r\nvar n: number = null;<\/pre>\n<h5>\u5909\u6570\u306e\u578b\u6ce8\u91c8<\/h5>\n<p>\u5909\u6570\u306e\u578b\u306f\u3001\u578b\u6ce8\u91c8\uff08Type Annotation\uff09\u3067\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u4e2d\u3067\u660e\u793a\u7684\u306b\u5ba3\u8a00\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u5909\u6570\u540d\u306e\u76f4\u5f8c\u306b\u30b3\u30ed\u30f3\u3068\u578b\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">var name: string = \"takayama\";<\/pre>\n<p>\u7701\u7565\u3082\u53ef\u80fd\u3067\u305d\u306e\u5834\u5408\u306f\u578b\u63a8\u8ad6(Type Inference)\u306b\u3088\u308a\u5909\u6570\u306e\u578b\u304c\u6c7a\u5b9a\u3055\u308c\u307e\u3059\u3002<\/p>\n<h4>\u914d\u5217<\/h4>\n<p>TypeScript\u3067\u306f\u914d\u5217\u306e\u8981\u7d20\u306e\u578b\u306f\u9759\u7684\u306b\u6c7a\u5b9a\u3055\u308c\u3001\u305d\u306e\u578b\u306e\u5024\u3057\u304b\u914d\u5217\u306b\u542b\u3081\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u305b\u3093\u3002<\/p>\n<p><strong>\u4f8b\uff1a\u914d\u5217\u306e\u8981\u7d20\u5168\u3066string\u306e\u5834\u5408\u3002<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">var colors: string&#x5B;] = &#x5B;\"black\", \"white\", \"yellow\", \"red\"];<\/pre>\n<p>\u914d\u5217\u306b\u95a2\u3057\u3066\u3082\u578b\u63a8\u8ad6\u304c\u6709\u52b9\u3067\u3001\u4e0a\u8a18\u3067\u578b\u7701\u7565\u3057\u305f\u5834\u5408\u306f\u81ea\u52d5\u7684\u306bstring[]\u3067\u3042\u308b\u3053\u3068\u3092\u63a8\u8ad6\u3057\u307e\u3059\u3002<br \/>\nnumber\u3084string\u306e\u6df7\u5408\u3055\u308c\u305f\u5834\u5408\u306f\u3001\u4f55\u3082\u30d7\u30ed\u30d1\u30c6\u30a3\u306e\u6301\u305f\u306a\u3044\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u914d\u5217\uff08{}[]\u578b\uff09\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>{}[]\u578b\u3068\u3057\u3066\u306e\u63a8\u8ad6<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">var hoge = &#x5B;\"webcyou\", 99, true];<\/pre>\n<h4>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u30ea\u30c6\u30e9\u30eb<\/h4>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">var obj = {};<\/pre>\n<p>JavaScript\u306f\u52d5\u7684\u578b\u4ed8\u3051\u306e\u305f\u3081\u3001\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u5f8c\u304b\u3089\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u8ffd\u52a0\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u304c\u3001TypeScript\u3067\u306f\u30b3\u30f3\u30d1\u30a4\u30eb\u30a8\u30e9\u30fc\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">var obj = {\r\n    name: \"takayama\"\r\n};\r\n\r\nobj.age = 36; \/\/age\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u8ffd\u52a0 \u30b3\u30f3\u30d1\u30a4\u30eb\u30a8\u30e9\u30fc\r\nconsole.log(obj.name, obj.age);<\/pre>\n<h4>\u95a2\u6570\u5b9a\u7fa9<\/h4>\n<h5>\u95a2\u6570\u3068TypeScript\u306e\u9759\u7684\u578b\u4ed8\u3051<\/h5>\n<p>TypeScript\u306f\u9759\u7684\u578b\u4ed8\u3051\u8a00\u8a9e\u3067\u3059\u306e\u3067\u3001\u95a2\u6570\u5b9a\u7fa9\u306b\u578b\u6ce8\u91c8\u3092\u4e0e\u3048\u308b\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">function hello(word: string): string {\r\n\u00a0 return \"hello,\" + word;\r\n}\r\n        \r\nvar result: string = hello(\"world!\");\r\nconsole.log(result);<\/pre>\n<p>\u3053\u306e\u5834\u5408\u3001\u5f15\u6570\u306bstring\u578b\u3001\u95a2\u6570\u3001\u623b\u308a\u5024\u306b\u3082string\u578b\u3092\u5b9a\u7fa9\u3057\u3066\u3044\u307e\u3059\u306e\u3067\u3001number\u578b\u304c\u8fd4\u3063\u3066\u304d\u305f\u5834\u5408\u30b3\u30f3\u30d1\u30a4\u30eb\u30a8\u30e9\u30fc\u3092\u8fd4\u3059\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h4>\u30a2\u30ed\u30fc\u95a2\u6570\u5f0f<\/h4>\n<p>\u30a2\u30ed\u30fc\u95a2\u6570\u5f0f\uff08Arrow Function Expressions\uff09\u306f\u7121\u540d\u95a2\u6570\u306e\u69cb\u6587\u3067\u3001\u30b7\u30f3\u30d7\u30eb\u306b\u8a18\u8ff0\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>ECMAScript 6\u3067\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u308bJavaScript\u306e\u65b0\u3057\u3044\u66f8\u304d\u65b9\u306b\u306a\u308a\u307e\u3059\u3002<br \/>\n<strong>TypeScript<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">var hello = (word: string): string =&gt; {\r\n    return &quot;Hello!&quot; + word;\r\n};<\/pre>\n<p><strong>JavaScript<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">var hello = function() {\r\n    return\u00a0\"Hello!\" + word;\r\n}<\/pre>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">(x: number) =&gt; { return Math.sin(x); }<\/pre>\n<p>\u5b9f\u884c\u5185\u5bb9\u304c1\u6587\u306e\u5834\u5408\u306f{}\u3068return\u3082\u7701\u7565\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">(x: number) =&gt; Math.sin(x);<\/pre>\n<p>\u5f15\u6570\u304c\uff11\u3064\u4e14\u3064\u3001\u578b\u6307\u5b9a\u3082\u306a\u3044\u5834\u5408\uff08\uff09\u3082\u7701\u7565\u53ef\u80fd<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">x =&gt;\u00a0{ return Math.sin(x); }<\/pre>\n<p>{}\u3068return\u3092\u7701\u7565<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">x =&gt;\u00a0Math.sin(x);<\/pre>\n<p>\u307e\u305f\u3001\u5f15\u6570\u306e\u500b\u6570\u3001\u305d\u308c\u305e\u308c\u306e\u578b\u3068\u623b\u308a\u5024\u306e\u578b\u3092\u3042\u3089\u304b\u3058\u3081\u6c7a\u3081\u3066\u304a\u304f\u3053\u3068\u3082\u53ef\u80fd\u3067\u3059\u3002<br \/>\n\u5f15\u6570\u3068\u3057\u3066string\u3092\u53d6\u308a\u3001string\u3092\u8fd4\u3059\u95a2\u6570\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><strong>TypeScript<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">var hello: (word: string) =&gt; string;\r\nhello = word =&gt; &quot;Hello,&quot; + word;<\/pre>\n<p><strong>JavaScript<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">var hello;\r\nhello = function (word) {\r\n    return \"Hello,\" + word;\r\n};<\/pre>\n<h5>\u7701\u7565\u53ef\u80fd\u5f15\u6570<\/h5>\n<p>\u7701\u7565\u53ef\u80fd\u306e\u5f15\u6570\u306e\u6307\u5b9a\u306f\u300c?\u300d\u3092\u8ffd\u52a0\u3059\u308b\u3053\u3068\u306b\u3088\u3063\u3066\u884c\u3048\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">var hello = (word?: string) =&gt; {\r\n    if (word === undefined) {\r\n        word = &quot;world&quot;;\r\n    }\r\n    \r\n    return &quot;Hello,&quot; + word;\r\n}\r\n\r\nhello(); \/\/Hello, world\r\nhello(&quot;webcyou&quot;); \/\/Hello, webcyou<\/pre>\n<h5>\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u4ed8\u304d\u5f15\u6570<\/h5>\n<p>\u307e\u305f\u3001\u5f15\u6570\u306b\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u5024\u3092\u4ed8\u4e0e\u3059\u308b\u5834\u5408\u306f\u300c=\u300d\u3092\u4f7f\u3063\u3066\u4ed8\u4e0e\u3057\u307e\u3059\u3002<\/p>\n<p><strong>TypeScript<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">var hello = (word = &quot;world&quot;) =&gt; &quot;Hello,&quot; + word;\r\nhello();\r\nhello(&quot;webcyou&quot;);<\/pre>\n<p><strong>JavaScript<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">var hello = function (word) {\r\n    if (typeof word === \"undefined\") { word = \"world\"; }\r\n        return \"Hello,\" + word;\r\n    };\r\n    hello();\r\n    hello(\"webcyou\");<\/pre>\n<h5>\u53ef\u5909\u9577\u5f15\u6570<\/h5>\n<p>\u5f15\u6570\u306e\u6570\u3092\u547c\u3073\u51fa\u3057\u5074\u304b\u3089\u81ea\u7531\u306b\u5897\u6e1b\u3055\u305b\u308b\u5f15\u6570\u306e\u5834\u5408\u3001\u300c&#8230;\u300d\u3067\u53ef\u5909\u9577\u5f15\u6570\u3092\u7528\u3044\u3066\u5b9f\u88c5\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><strong>TypeScript<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">var hello = (...words: string&#x5B;]) =&gt; {\r\n    return &quot;Hello,&quot; + words.join(&quot;,&quot;);\r\n}\r\nvar result = hello(&quot;webcyou&quot;, &quot;takayama&quot;);\r\nconsole.log(result);<\/pre>\n<p><strong>JavaScript<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">var hello = function () {\r\n    var words = &#x5B;];\r\n    for (var _i = 0; _i &lt; (arguments.length - 0); _i++) {\r\n        words&#x5B;_i] = arguments&#x5B;_i + 0];\r\n    }\r\n    return &quot;Hello,&quot; + words.join(&quot;,&quot;);\r\n};\r\nvar result = hello(&quot;webcyou&quot;, &quot;takayama&quot;);\r\nconsole.log(result);<\/pre>\n<h4>\u30af\u30e9\u30b9<\/h4>\n<p>\u3068\u3001\u3084\u3063\u3068\u672c\u984c\u306b\u5165\u308b\u6c17\u304c\u3057\u307e\u3059\u3002\u3002<\/p>\n<p>JavaScript\u306f\u7c21\u5358\u306b\u8272\u3093\u306a\u30b9\u30bf\u30a4\u30eb\u3067\u81ea\u7531\u306b\u66f8\u3051\u308b\u304c\u6545\u306b\u3001\u69d8\u3005\u306a\u66f8\u304d\u65b9\u3084\u6d41\u5100\u304c\u5b58\u5728\u3057\u3066\u3057\u307e\u3044\u6280\u8853\u7684\u8ca0\u50b5\u3092\u91cf\u7523\u3057\u3066\u3057\u307e\u3044\u304c\u3061\u3067\u3059\u3002<\/p>\n<p>\u305d\u3053\u304b\u3089\u751f\u307e\u308c\u308b\u30bd\u30fc\u30b9\u3092\u7406\u89e3\u3059\u308b\u30b3\u30b9\u30c8\u3084\u6df7\u4e71\u3001\u307e\u305f\u5c11\u3057\u4fee\u6b63\u3092\u884c\u304a\u3046\u3068\u3059\u308b\u3068\u3001\u30d0\u30b0\u304c\u767a\u751f\u3057\u305f\u308a\u3068\u69d8\u3005\u306a\u554f\u984c\u304c\u767a\u751f\u3057\u304c\u3061\u3067\u3059\u304c\u3001\u305d\u308c\u3089\u3092\u89e3\u6c7a\u3059\u308b\u624b\u6bb5\u306e1\u3064\u3068\u3057\u3066\u3001TypeScript\u306b\u30af\u30e9\u30b9\u306f\u7528\u610f\u3055\u308c\u3066\u304a\u308a\u307e\u3059\u3002<\/p>\n<h5>\u5b9a\u7fa9<\/h5>\n<p>\u30af\u30e9\u30b9\u3092\u5b9a\u7fa9\u3059\u308b\u306b\u306f\u300cclass\u300d\u306e\u5f8c\u306b\u30af\u30e9\u30b9\u540d\u3092\u8a18\u8ff0\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">class Greeter {\r\n    greeting: string;\r\n}\r\nvar greeter = new\u00a0Greeter();<\/pre>\n<p>\u30af\u30e9\u30b9\u3092\u4f7f\u3046\u969b\u306f\u300cnew\u300d\u6f14\u7b97\u5b50\u3092\u4f7f\u3044\u3001\u300cnew \u30af\u30e9\u30b9\u540d();\u300d\u3068\u8a18\u8ff0\u3059\u308b\u3053\u3068\u3067\u30af\u30e9\u30b9\u306e\u65b0\u3057\u3044\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u5f97\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<h5>\u7d99\u627f<\/h5>\n<p>\u30af\u30e9\u30b9\u306e\u7d99\u627f\u306f\u300c<strong>extends<\/strong>\u300d\u3092\u7528\u3044\u3066\u7d99\u627f\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">class Base {\r\n    name: string;\r\n    hello() {\r\n        return \"Hello,\" + this.name;\r\n    }\r\n}\r\n\r\nclass Child extends Base {\r\n    constructor(name: string) {\r\n        super();\r\n        this.name = name;\r\n    }\r\n    howAreYou() {\r\n        return this.hello() + \". How are you?\";\r\n    }\r\n}\r\n\r\nvar result = new Child(\"takayama\").howAreYou();\r\nconsole.log(result);<\/pre>\n<h5>\u30a2\u30af\u30bb\u30b9\u4fee\u98fe\u5b50<\/h5>\n<p>\u30af\u30e9\u30b9\u306e\u5909\u6570\u3084\u30e1\u30bd\u30c3\u30c9\u306a\u3069\u306e\u8981\u7d20\u306b\u30a2\u30af\u30bb\u30b9\u4fee\u98fe\u5b50\u3092\u4ed8\u4e0e\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<ul>\n<li><strong>public\uff1a\u00a0<\/strong>\u30af\u30e9\u30b9\u306e\u5916\u90e8\u306b\u516c\u958b\u3057\u3066\u3001\u5916\u90e8\u304b\u3089\u306e\u30a2\u30af\u30bb\u30b9\u3092\u8a31\u53ef\u3059\u308b\u3002<\/li>\n<li><strong>private\uff1a<\/strong>\u00a0\u30af\u30e9\u30b9\u5185\u90e8\u304b\u3089\u306e\u30a2\u30af\u30bb\u30b9\u3060\u3051\u3092\u8a31\u53ef\u3057\u3001\u5916\u90e8\u306b\u306f\u975e\u516c\u958b\u3002<\/li>\n<\/ul>\n<div>\u7701\u7565\u306e\u5834\u5408\u306f \u300c<strong>public<\/strong>\u300d\u3068\u306a\u308a\u307e\u3059\u3002<\/div>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">class Sample {\r\n    private str1 = \"yeah!!!\";\r\n    public str2 = \"webcyou\";\r\n\r\n    private hello(word = \"world\") {\r\n        return \"Hello!\" + word;\r\n    }\r\n\r\n    public hellowith(word = \"world\") {\r\n        return this.hello(word) + \"!\";\r\n    }\r\n\r\n    public yeah(word = \"world\") {\r\n        return this.str1 + \",\" + word;\r\n    }\r\n}\r\n\r\nvar sample = new Sample();\r\nvar s1 = sample.str1; \/\/\u30a8\u30e9\u30fc\r\nvar s2 = sample.str2;\r\nvar s3 = sample.hello() ; \/\/\u30a8\u30e9\u30fc\r\nvar s4 = sample.hellowith();\r\nvar s5 = sample.yeah();<\/pre>\n<h4>\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf<\/h4>\n<p>\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u306f\u300c<strong>constructor<\/strong>\u300d\u3067\u5b9a\u7fa9\u3057\u307e\u3059\u3002<\/p>\n<p>\u4e3b\u306b\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u5909\u6570\u3092\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u3067\u521d\u671f\u5316\u3092\u884c\u3046\u969b\u306b\u5229\u7528\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">class Greeter {\r\n    greeting: string;\r\n    constructor(message: string) {\r\n        this.greeting = message;\r\n    }\r\n    greet() {\r\n        return \"Hello, \" + this.greeting;\r\n    }\r\n}<\/pre>\n<p>\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u306e\u5f15\u6570\u306b\u300cpublic\u300d\u3084\u300cprivate\u300d\u306e\u4fee\u98fe\u5b50\u3092\u4ed8\u4e0e\u3059\u308b\u3053\u3068\u3082\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">constructor(public message: string) { \u301c\u301c<\/pre>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">constructor(private message: string) {\u301c\u301c<\/pre>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">class Greeter {\r\n    message: string;\r\n    constructor(message: string) {\r\n        this.message = message; \r\n    }\r\n}<\/pre>\n<p>\u2193<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">class Greeter {\r\n    constructor(public message: string) {\r\n    }\r\n}<\/pre>\n<h4>\u300cget\u300d\u300c set\u300d<\/h4>\n<p>\u300cget\u300d\u300cset\u300d\u30a2\u30af\u30bb\u30b5\u3092\u5b9a\u7fa9\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">class Sample {\r\n    private _secretString: string;\r\n    \r\n    get str(): string {\r\n        return this._secretString;\r\n    }\r\n    \r\n    set str (value: string) {\r\n        this._secretString = value;\r\n    }\r\n}<\/pre>\n<h4>\u30aa\u30fc\u30d0\u30fc\u30e9\u30a4\u30c9<\/h4>\n<p>\u30e1\u30bd\u30c3\u30c9\u306e\u30aa\u30fc\u30d0\u30fc\u30e9\u30a4\u30c9\u3082\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">class Base {\r\n    greeting() {\r\n        return \"Hello\";\r\n    }\r\n}\r\n\r\nclass Childs extends Base {\r\n    greeting() {\r\n        return \"Hey!\";\r\n    }\r\n}\r\n\r\nvar obj = new Childs();\r\nconsole.log(obj.greeting());<\/pre>\n<h5>super\u30ad\u30fc\u30ef\u30fc\u30c9<\/h5>\n<p>\u300csuper\u300d\u30ad\u30fc\u30ef\u30fc\u30c9\u3092\u4f7f\u3048\u3070\u5b50\u30af\u30e9\u30b9\u304b\u3089\u89aa\u30af\u30e9\u30b9\u306epublic\u306a\u30e1\u30bd\u30c3\u30c9\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">class Base {\r\n    constructor() { \r\n        console.log(\"BaseClass\");\r\n    }\r\n    method() {\r\n        return \"Base\";\r\n    }\r\n}\r\n\r\nclass Childs extends Base {\r\n    constructor() { \r\n        super();\r\n        console.log(\"ChildClass\");\r\n    }\r\n    method() {\r\n        return \"Child\";\r\n    }\r\n \r\n    test() {\r\n        return super.method(); \r\n    }\r\n}\r\n\r\nvar obj = new Childs();\r\nconsole.log(obj.test());<\/pre>\n<p><strong>console.log<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">BaseClass\r\nChildClass\r\nBase<\/pre>\n<h4>\u30b9\u30bf\u30c6\u30a3\u30c3\u30af\u30e1\u30f3\u30d0<\/h4>\n<p>\u300cstatic\u300d\u3092\u4ed8\u4e0e\u3057\u305f\u30e1\u30f3\u30d0\u306f\u30b9\u30bf\u30c6\u30a3\u30c3\u30af\u306a\u30e1\u30f3\u30d0\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">class Greeter {\r\n    static hello(word = \"world\") {\r\n        return \"Hello,\" + word;\r\n    }\r\n        \r\n    hello(word = \"webcyou!\") {\r\n        return \"Hello,\" + word;\r\n    }\r\n}\r\n\r\nvar a = Greeter.hello() ;\r\nvar b = new Greeter().hello();\r\n\r\nconsole.log(a, b);<\/pre>\n<p><strong>console.log<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">Hello,world Hello,webcyou!<\/pre>\n<p>a\u306f\u30af\u30e9\u30b9\u306b\u7d10\u3065\u304f\u30b9\u30bf\u30c6\u30a3\u30c3\u30af\u30e1\u30bd\u30c3\u30c9\u3092\u5229\u7528\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\nb\u306f\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u30e1\u30bd\u30c3\u30c9\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<h4>\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9<\/h4>\n<p>\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u306f\u5b9f\u88c5\u3092\u6301\u305f\u306a\u3044\u5b9a\u7fa9\u306e\u584a\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">interface Data {\r\n    num: number;\r\n    score: number;\r\n    text: string;\r\n    method(): string;\r\n}\r\n\r\nclass PrivateData implements Data {\r\n    constructor(\r\n        public num: number,\r\n        public score: number,\r\n        public text: string\r\n    ) { \r\n    }\r\n    method() {\r\n        return \"num:\" + this.num + \", score:\" + this.score + \" \" + this.text;\r\n    }\r\n}\r\n\r\nvar a = new PrivateData(1,100,\"\u7372\u5f97!\");\r\nconsole.log(a.method());<\/pre>\n<p>console.log<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">num:1, score:100 \u7372\u5f97!<\/pre>\n<h5>\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30a4\u30b9\u306e\u7d99\u627f<\/h5>\n<p>\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30a4\u30b9\u3082<strong>extends\u3092\u7528\u3044\u3066\u7d99\u627f\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd<\/strong>\u3067\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">interface AllMessage extends Message {\r\n    contents: any;\r\n}<\/pre>\n<h4>\u30e2\u30b8\u30e5\u30fc\u30eb<\/h4>\n<p>\u5185\u90e8\u30e2\u30b8\u30e5\u30fc\u30eb\uff08Internal Module\uff09\u306fTypeScript\u81ea\u8eab\u306b\u7528\u610f\u3055\u308c\u305f\u30e2\u30b8\u30e5\u30fc\u30eb\u6a5f\u80fd\u3067\u3001TypeScript\u306e\u30b3\u30fc\u30c9\u306f\u5185\u90e8\u30e2\u30b8\u30e5\u30fc\u30eb\u306b\u3088\u308a\u5206\u5272\u3055\u308c\u305f\u540d\u524d\u7a7a\u9593\u304c\u63d0\u4f9b\u3055\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">module Sample {\r\n    var value = \"webcyou\";\r\n    function hoge(arg: string): void {\r\n        console.log(\"hoge\");\r\n    }\r\n    class Webcyou {\r\n        method(){}\r\n    }\r\n\r\n    module NestSample {\r\n        var hoge = \"hoge\";\r\n    }\r\n}<\/pre>\n<p>\u30af\u30e9\u30b9\u3084\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3084\u30cd\u30b9\u30c8\u3057\u305f\u30e2\u30b8\u30e5\u30fc\u30eb\u3082\u5b9a\u7fa9\u3067\u304d\u307e\u3059\u3002<\/p>\n<h5>\u30e2\u30b8\u30e5\u30fc\u30eb\u30e1\u30f3\u30d0\u306e\u30a8\u30af\u30b9\u30dd\u30fc\u30c8<\/h5>\n<p>\u5916\u90e8\u53c2\u7167\u3092\u884c\u3044\u305f\u3044\u969b\u306f\u300cexport\u300d\u30ad\u30fc\u30ef\u30fc\u30c9\u3067\u30a8\u30af\u30b9\u30dd\u30fc\u30c8\u3055\u305b\u53c2\u7167\u3092\u884c\u3046\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">module MyApp {\r\n\r\n\u00a0 \u00a0class NotExported {\r\n\u00a0 \u00a0 }\r\n\r\n    export class Exported {\r\n    }\r\n\r\n    export module InnerModule {\r\n\r\n        export class Exported {\r\n        }\r\n    }\r\n}\r\n\r\nvar a = new\u00a0MyApp.NotExported(); \/\/\u30a8\u30e9\u30fc\r\nvar a = new\u00a0MyApp.Exported(); \/\/OK\r\nvar a = new\u00a0MyApp.InnerModule.Exported(); \/\/OK<\/pre>\n<h4>\u7dcf\u79f0\u578b<\/h4>\n<p>\u7dcf\u79f0\u578b(Generic Types)\u306f\u3001\u30af\u30e9\u30b9\u3084\u95a2\u6570\u306e\u578b\u5b9a\u7fa9\u306e\u4e00\u90e8\u3092\u30d1\u30e9\u30e1\u30fc\u30bf\u5316\u3059\u308b\u3053\u3068\u30671\u3064\u306e\u5b9a\u7fa9\u3067\u69d8\u3005\u306a\u7528\u9014\u306b\u5bfe\u5fdc\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b\u305f\u3081\u306e\u65b9\u6cd5\u3067\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">class DataContainer&lt;Type&gt; {\r\n    data: Type;\r\n}\r\n\r\nvar a = new\u00a0DataContainer&lt;string&gt;() ;\r\n\r\na.data = &quot;data&quot;; \/\/OK\r\nvar b = new\u00a0DataContainer&lt;boolean&gt;() ;\r\n    b.data = true;\/\/OK<\/pre>\n<h4>\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9\u30b3\u30e1\u30f3\u30c8<\/h4>\n<p>ts\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u4ed6\u306e\u30bd\u30fc\u30b9\u30d5\u30a1\u30a4\u30eb\u306e\u30e2\u30b8\u30e5\u30fc\u30eb\u3084\u95a2\u6570\u7b49\u3092\u53c2\u7167\u3059\u308b\u5834\u5408\u3001\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9\u30b3\u30e1\u30f3\u30c8\u3092\u7528\u3044\u308b\u3053\u3068\u3067\u53ef\u80fd\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\/\/\/ &lt;reference path=&quot;hello.ts&quot; \/&gt;<\/pre>\n<p>d.ts\u30d5\u30a1\u30a4\u30eb<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\/\/\/ &lt;reference path=&quot;..\/..\/..\/angularjs\/angular.d.ts&quot; \/&gt;<\/pre>\n<p>d.ts\u30d5\u30a1\u30a4\u30eb\u306f\u578b\u5b9a\u7fa9\u30d5\u30a1\u30a4\u30eb\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u30e1\u30b8\u30e3\u30fc\u306a\u5b9a\u7fa9\u30d5\u30a1\u30a4\u30eb\u306f\u3053\u3061\u3089\u3067\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><a href=\"http:\/\/definitelytyped.org\/tsd\/\" target=\"_blank\">http:\/\/definitelytyped.org\/tsd\/<\/a><\/p>\n<p>npm \u3092\u7528\u3044\u3066\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">npm install tsd -g<\/pre>\n<h4>grunt\u3067\u4f7f\u7528<\/h4>\n<p>\u3068\u3056\u3063\u3068\u3001TypeScript\u306b\u95a2\u3057\u3066\u307e\u3068\u3081\u3066\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>\u3067\u3001\u5b9f\u969b\u3069\u3046\u4f7f\u3046\u306e\u304b\u3068\u3044\u3044\u307e\u3059\u3068\u3001\u6bce\u5ea6\u6bce\u5ea6\u30b3\u30f3\u30d1\u30a4\u30eb\u3092\u3059\u308b\u308f\u3051\u3067\u3082\u306a\u304fgrunt-typescript\u7b49\u304c\u3042\u308a\u307e\u3059\u306e\u3067\u3001\u3053\u3061\u3089\u3092\u4f7f\u3063\u3066watch\u3067\u30b3\u30f3\u30d1\u30a4\u30eb\u3055\u305b\u308b\u65b9\u6cd5\u304c\u6700\u3082\u30d9\u30bf\u30fc\u306a\u65b9\u6cd5\u3067\u3057\u3087\u3046\u3002<\/p>\n<p><a href=\"https:\/\/www.npmjs.org\/package\/grunt-typescript\" target=\"_blank\">https:\/\/www.npmjs.org\/package\/grunt-typescript<\/a><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">npm install grunt-typescript<\/pre>\n<p>\u6b21\u56de\u306f\u3082\u3063\u3068\u8a73\u7d30\u306a\u3068\u3053\u308d\u3092\u66f8\u3044\u3066\u3044\u3051\u308c\u3070\u3068\u601d\u3044\u307e\u3059\u3002<br \/>\n\u3067\u306f\u3067\u306f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>TypeScript\u3067\u5b9f\u88c5\u3092\u884c\u3063\u3066\u65e9\u534a\u5e74\u4ee5\u4e0a\u304c\u904e\u304e\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u3002\u3002\u3002 \u81ea\u7531\u5954\u653e\u306bJavaScript\u3092\u66f8\u3044\u3066\u3044\u307e\u3057\u305f\u304c\u3001\u3059\u3063\u304b\u308a\u7e1b\u3089\u308c\u305f\u3044\u4f53\u3068\u306a\u3063\u3066\u3057\u307e\u3044\uff08\u5909\u306a\u65b9\u5411\u3060\u306a\u3002\uff09TypeScropt\u7121\u3057\u3067\u306f\u3082\u3046\u751f\u304d\u3089\u308c\u306a\u3044\u306e [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[176,166,47,179,50,46,178,78,114],"class_list":["post-5588","post","type-post","status-publish","format-standard","hentry","category-javascript","tag-html5","tag-iphone","tag-javascript-2","tag-jquery","tag-jquery-mobile","tag-js","tag-178","tag-78","tag-114"],"_links":{"self":[{"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/posts\/5588","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5588"}],"version-history":[{"count":6,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/posts\/5588\/revisions"}],"predecessor-version":[{"id":5597,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/posts\/5588\/revisions\/5597"}],"wp:attachment":[{"href":"https:\/\/www.webcyou.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5588"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5588"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5588"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}