Integrating TypeScript with Sublime Text2

In this article we are going to focus on how to integrate the TypeScript with Sublime Text 2. For the basic introduction to TypeScript, TypeScript is a Super script of JavaScript and it is strictly typed language.

In this article we are going to focus on how to integrate the TypeScript with Sublime Text 2.

Assuming that we have Sublime Text 2 already installed on our windows machine.

Step 1: Go to the below link and then click on "TypeScript support for
Sublime Text". This will download the "" folder. Now unzip this folder.

Step 2: Now copy the "typescript.tmLanguage" TMLanguage file and paste it in the "C:\Users\NameofUser\AppData\Roaming\Sublime Text 2\Packages\User" folder.

In the above path Nameofuser is generally the user logged into the machine so replace it with your name as logged in.

Step 3: Now open Sublime Text2 editor -> Go to Tools -> Build System -> New Build System and paste the below instructions in the opened file.

"cmd": ["tsc.cmd","$file"],
"file_regex": "^(.+?) \\((\\d+),(\\d+)\\): (.+)$"

Step 4: Now save this file in the same folder as above with the name "Typescript.sublime-build".

Step 4: Now create a new file and paste the below code. Save the file as "Demo.ts". Here is the typescript extension.

class Greeter {
msg: string;
constructor(message: string) {
this.msg = message;
greet() {
return "Hi, " + this.msg;

var greeter = new Greeter("Vaishali");

var button = document.createElement('button');
button.textContent = "Say Hi";
button.onclick = function() {


Step 5: Now press Ctrl + Shift + B to build the file. If the build is successful. It gives a Build Finished message.

Now lets see what happens if there is some error in the above code.

In the below code, Replace msg with msgd and Build the file.

return "Hi, " + this.msg;

replace with

return "Hi, " + this.msgd;

Then you should get a build failed error something as shown below:

C:/DemoApp/Demo.ts(7,30): error TS2339: Property 'msgd' does not exist on type 'Greeter'.
[Finished in 3.2s]


You can also observe that intellisense should also work as shown below:




  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: