-Created by Microsoft
-Code will be transpiled in JavaScript
-Strongly typed
npm install -g typescript
Check version
tsc -v
**ES3 (by default)
tsc filename.ts
**ES5
tsc filename.ts --target es5
tsc -w --pretty filename.ts --target es5
Create tsconfig.json
at project’s root.
{
"compilerOptions": {
"target": "ES5",
"pretty": true,
"outDir": "./build"
},
"files": [
"demo.ts",
"class.ts"
],
"exclude": ["node_modules"]
}
Launch transpiler :
tsc -w