TypeScript and Visual Studio Code
-
Upload
akira-inoue -
Category
Technology
-
view
653 -
download
3
Transcript of TypeScript and Visual Studio Code
Microsoft Openness
~ TypeScript and Visual Studio Code ~
井上 章 (いのうえあきら)
http://aka.ms/chack
日本マイクロソフト株式会社デベロッパーエバンジェリズム統括本部 (DX)
エバンジェリスト
井上 章 (いのうえ あきら)
エバンジェリスト
http://aka.ms/chack
2008 年マイクロソフト入社。
主に .NET/ASP.NET や Visual Studio, Microsoft Azure などの開発技術を専門とするエバンジェリストとして、技術書籍やオンライン記事などの執筆、さまざまな技術イベントでの講演などを行う。
TypeScriptファイル
(*.ts)
TypeScriptコンパイラ
(tsc)
JavaScriptファイル
(*.js)
TypeScript型定義ファイル
(*.d.ts)
JavaScript実行エンジン
Node.js または
WSH (WScript.Shell)で実行
ECMAScript 3 (ES3)ECMAScript 5 (ES5)ECMAScript 2015 (ES2015) 試験的実装
Web ブラウザーやNode.js など
JavaScript のあいまいさを排除し、安全性・可読性・生産性を向上
interface I { }
class C { }
module M { }
{ s: string; }
number[]
() => boolean
// Numbervar x: number; // 明示的var y = 0; // y: number と同じ
// Booleanvar b: boolean; // 明示的var yes = true; // yes: boolean = true と同じ
// Stringvar s: string; // 明示的var n = "akira"; // n: string = "akira" と同じ
// Enumenum Color { Red, Green, Blue }var myColor = Color.Red;Console.log(Color[myColor]); // Red
interface, class, namespace などのオブジェクト指向言語構文の導入
interface Dog {name: string;Talk: () => string;
}
class Corgi implements Dog {name: string;constructor(name: string) {
this.name = name;}Talk(): string {
return "Bow wow!";}
}
class myDog extends Corgi {constructor() {
super("reo");}Talk(): string {
return "Wan wan!";}
}
namespace M {export var reo = new myDog();
}
alert(M.reo.Talk());
ジェネリクス (Generics) 構文
アロー関数式 (ES2015 匿名関数構文)
Get / Set アクセサ構文 (プロパティ)
class Human<T> { ... }var me = new Human<string>("Akira");
var a = function (x: number) { return Math.sin(x); } // 標準式var b = x => Math.sin(x)
class Who {private _name: string;get Name() { return this._name; }set Name(name: string) { this._name = name; }
}
Visual Studio Codehttp://code.visualstudio.com/
Code optimized editor
Intellisense, debugging, GIT
Windows + Mac + Linux
Open Source