- Remove old version of Typescript (only applies to machines with Visual Studio installed)
- Browse to folder: C:\Program Files (x86)\Microsoft SDKs\TypeScript
- Delete any folder with a version number < 2.0 (eg 1.0)
- Install global tooling:
- git
- nodejs and npm
- Optional: Visual Studio Code
- typescript:
npm install -g [email protected]
- typings:
npm install typings --global
- fork this repo
- clone the forked repo locally
- open a cmd prompt with the current directory set to the locally cloned directory
- at this command prompt install project locally:
npm install
- installs both npm modules and any references typescript definition files
- uses the exact versions of npm modules as defined in npm-shrinkwrap.json
Compile typescript and launch web server
npm start
- runs the
tsc
tool using the options defined in thetsconfig.json
tsc
is configured to watch for changes to your typescript files and recompile them- lauches
index.html
in the browser at http://localhost:3000/
Compile typescript only
tsc
Compile typescript when files change
tsc -w
Compiling
The task runner has been configured to run the typescript compiler using the shortcut keys:
CTLR+SHIFT+B
This is equivalent as running tsc
at the command line
Debugging
VSC has been configured to launch a debugger and run the code in main.ts. Press the shortcut key: F5
However, you will find that before you can debug the code you will need to ensure that typescript compiles the code into a module format understood by nodejs ie CommonJS
module format. To do this:
- Open the
tsconfig.json
file - Change
"module": "system"
->"module": "commonjs"
- Recompile the code (tip:
CTLR+SHIFT+B
)