TypeScript Compiler
1. Node.js - Node Package Manager(npm)インストール
Node.js公式ウェブサイトからNode.jsを入手。
2. TypeScript Compiler インストール
· グローバル
sudo npm install -g typescript
· ローカル
npm install -save-dev typescript
3. TypeScript Compiler(tsc)バージョン確認
· グローバル
tsc -v
· ローカル
./node_modules/.bin/tsc -v
4. オプションファイル(tsconfig.json)作成
· グローバル
tsc -init
· ローカル
./node_modules/.bin/tsc -init
5. tsconfig.json
{
"compilerOptions": {
"rootDir": "./source",
"outDir": "./distribution",
"module": "ES6",
"target": "ES6",
"strict": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true
},
"include": [
"source/**/*"
]
}
6. コンパイル
グローバル
tsc
ローカル
./node_modules/.bin/tsc