Home How to install typescript on mac os x
Post
Cancel

How to install typescript on mac os x

typescript

This article explains how to install TypeScript on Mac OS X easily.

The following steps are tested on OS X Mountain Lion 10.8.2

1. install Homebrew:

1
$ ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"

2. Install nodejs using home-brew:

1
$ brew install nodejs

3. get and install npm:

1
$ curl https://npmjs.org/install.sh | sh

4. get TypeScript:

1
$ npm install -g typescript

5. Test TypeScript:

In your editor, type the following JavaScript code in greeter.ts:

1
2
3
4
5
function greeter(person) {
  return "Hello, " + person;
}
var user = "Jane User";
document.body.innerHTML = greeter(user);

6. Compile the code:

At the command line, run the TypeScript compiler:

1
$ tsc greeter.ts

The result will be a file greeter.js which contains the same JavaScript that you fed in.

This post is licensed under CC BY-NC-SA 4.0 by the author.

Boxman Puzzle

Java Micro Blogging System