TypeScript experiments

We are trying out a new language, TypeScript. Basically, it is an intermediate language that gives JavaScript strong types, among other interesting stuff. It is aligned with the future specification of ECMAScript 6.

I am following this tutorial, which aims to build a chat server using TypeScript and WebSockets.


Installing TypeScript and Node (Mac OS X)

Fixing Webstorm debugger

Add the following line to the WebStorm/Contents/bin/webstorm.vmoptions file (Show Package Contents in Webstorm App)

Otherwise it may crash on debugging.

Configuring WebStorm IDEA for TS Development

The built-in TS transpiler of Webstorm IDEA is old and does not work. Need to configure it to use the new transpiler:

In my machine, it was installed into this folder:

Set up the path to the TS transpiler in the Webstorm Preferences (Cmd+,) as shown below

 Screen Shot 2016-02-19 at 02.27.36

Set path to Node Interpreter

Path to compiler

Screen Shot 2016-02-19 at 02.27.42

Scope has to be the entire module (name of your WebStorm project) so that the transpiler monitors the whole project for changes.

Command line options:

Create new Run configuration

The main Javascript File will be the equivalent of the “app.js” file for a NodeJS Express App, but generated by TypeScript this time. Select it in this window, as well as the path to the Node interpreter.

Screen Shot 2016-02-19 at 02.32.08


Happy development using a proper debugger 🙂

Screen Shot 2016-02-19 at 02.28.14

Leave a Comment