Karlom Karlom - 2 years ago 117
AngularJS Question

How to autoamtically transpile TypeScript to JavaScript?

I am learing angularjs2 by reading a 2015 book

but the node package that it uses
to transpile typescript to javascript on the fly is discontinued is deprecated:

npm WARN deprecated tsd@0.6.5: TSD is deprecated in favor of Typings
(https://github.com/typings/typings) - see
https://github.com/DefinitelyTyped/tsd/issues/269 for more information

. I have other methods on different tutorials bu I'm wondering if there is any consensus on how best to transpile at the development machine?

Here is the package.json that I use:

"name": "ng-book2-reddit",
"version": "1.0.0",
"private": true,
"scripts": {
"clean": "rm -f ./*.js; rm -f ./*.js.map; rm -f ./intermediates/*.js; rm -f ./intermediates/*.js.map",
"tsc": "./node_modules/.bin/tsc",
"tsc:w": "./node_modules/.bin/tsc -w",
"serve": "./node_modules/.bin/live-server --host=localhost --port=8080 .",
"go": "concurrent \"npm run tsc:w\" \"npm run serve\" "
"license": "ISC",
"dependencies": {
"@angular/common": "2.0.0-rc.1",
"@angular/compiler": "2.0.0-rc.1",
"@angular/core": "2.0.0-rc.1",
"@angular/http": "2.0.0-rc.1",
"@angular/platform-browser": "2.0.0-rc.1",
"@angular/platform-browser-dynamic": "2.0.0-rc.1",
"@angular/router": "2.0.0-rc.1",
"core-js": "2.2.2",
"es6-shim": "^0.35.0",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.6",
"systemjs": "^0.19.6",
"ts-helpers": "1.1.1",
"tslint": "3.7.0-dev.2",
"typescript": "1.9.0-dev.20160409",
"typings": "^0.8.1",
"zone.js": "0.6.12"
"devDependencies": {
"concurrently": "1.0.0",
"live-server": "0.9.0",
"typescript": "1.7.3"

Answer Source

In this case use

npm run tsc:w

In your package.json

"tsc:w": "./node_modules/.bin/tsc -w",

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download