
ご存知のように、Visual Studio 2015は昨夜リリースされましたが、同時に、MicrosoftはTypeScript 1.5の最終バージョンを新しいVisual Studioに含めて
導入しました。 VSの以前のバージョン用に個別にダウンロードするか、npmを使用してインストールすることもできます。 カットの下-新しいリリースで興味深いものの短いリスト。
部分的なES6構文のサポート
MicrosoftはTypeScriptにES6との下位互換性を持たせたいと考えており、新しいリリースごとに体系的に新しい標準の構文を追加しています。 バージョン1.5は、特に
モジュールのES6構文、構造化 、
省略演算子 、
for ... of 、
文字 、
計算されたプロパティ 、
let / constサポート 、
文字列 標準化の イテレーションが豊富です。 弦の標準化、カール!
モジュールシステムの改善
モジュールのES6構文のサポートに加えて、2つの新しいモジュール読み込み形式へのコンパイルが追加されました:SystemJSとUMD。 既にサポートされているCommonJSおよびAMDとともに、生成されたコードのモジュールをロードするための4つのオプションのいずれかを選択できます。
また、開発チームは内部モジュールの名前を「名前空間」に変更したため、「typescriptモジュール」と「typescript外部モジュール」は同じものになりました。 彼らは、新しい開発者が不満を言い、混乱したと言います。
Tsconfig.json構成ファイル
コンパイルおよびコンパイラ設定用のファイルのリストを指定できます。
{ "compilerOptions": { "module": "commonjs", "noImplicitAny": true, "removeComments": true, "preserveConstEnums": true, "out": "../../built/local/tsc.js", "sourceMap": true }, "files": [ "core.ts", "sys.ts", "types.ts", "scanner.ts" ] }
ES7デコレータ
ES7標準はまもなく安定しませんが、TypeScriptは実験モードではありますが、すでに新しいデコレータ構文を使用できます。
import {Component, View, NgFor, bootstrap} from "angular2/angular2"; import {loadFile} from "audioFile"; import {displayAudioFile} from "displayAudio"; @Component({selector: 'file-list'}) @View({template: ` <select id="fileSelect" size="5"> <option *ng-for="#item of items; #i = index" [selected]="selected === item"(click)="updateSelection()">{{ item }}</option> </select>`, directives: [NgFor] }) class MyDisplay { items: string[]; constructor() { this.items = ["item1", "item2"]; } updateSelection() { … } }