Upgrading to the latest TypeScript from source

Hi, my little exercise was to update TypeScript in VS2015 to the latest from the master branch in git, I wanted abstract classes.

It's really not that hard, just not very much documentation on it. In this guide, you will want to replace "c:\development\" with the path you clone the TypeScript git repository into. I'm showing how to do this on a 64-bit system, so if you are using a 32-bit system change Program Files (x86) to just Program Files.

First step is compiling TypeScript, here's a quick guide for the current latest version (1.5)

  1. If you don't have Git, you will need to install it. https://windows.github.com/
  2. Install Node.JS (yes, it's needed to compile TypeScript) - https://nodejs.org/
  3. Open your git shell.
  4. cd to where you want to put your git repository cd c:\development\
  5. Clone the git repository git clone https://github.com/Microsoft/TypeScript.git
  6. Follow the directions on https://github.com/Microsoft/TypeScript to build the TypeScript libraries. At the time of writing they were
    • Open the nodejs command prompt
    • cd to the directory you cloned the repository into cd c:\development\TypeScript
    • Install jake npm install -g jake
    • Install other modules npm install
    • Compile jake local

Now, some places say you can execute the powershell script c:\development\TypeScript\scripts\VSDevMode.ps1 -tsScript "c:\development\TypeScript\built\local\" but, for me that was only part of it. That enabled only the intellisense in VS and nothing else, compiling didn't work as it was still compiling with the original TypeScript libraries (1.5 at the time of writing). Copying the files as explained below made intellisense and compiling work correctly.

To compile using the new version, I needed to replace some files from VS and the SDK. The compiled libraries for TypeScript are in c:\development\TypeScript\built\local. You will need to copy the matching files into the following folders:

  1. C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.5\
    • Note: The 1.5 is the latest version as of this writing, going up a folder in the TypeScript folder you may see a higher version, 1.6, 1.7 etc. If there is a higher version you probably need to put the files in there instead.
    • lib.d.ts
    • lib.es6.d.ts
    • tsc.js
  2. C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TypeScript
    • lib.d.ts
    • lib.es6.d.ts
    • typescriptServices.js

You should of course back up those files before you overwrite them in case you want to go back to the official version.If you are on the official 1.5 (or older) the following TypeScript will not compile. If you did the steps correctly to get to the latest version, it will. The abstract keyword was not in the official 1.5 release, it was added to the master branch after it was release.

abstract class baseClass{
	abstract doit();
}

class implementedClass extends baseClass{
	doit(){
		alert("bye");
	}
}

var p = new implementedClass();
p.doit();