Typescript compiler, where art thou

I was trying to experiment with Typescript and Visual Studio code, and I found that there are at least three versions of TypeScript compiler one might have:

1. Microsoft compiler tsc.exe that sits in C:\Program Files (x86)\Microsoft SDKs\TypeScript\x.y. It gets installed with Visual Studio. Several versions can be installed side by side: I have 1.0, 1.7, and 1.8, but only one of them will be on the path.

2. Compiler that comes with npm “typescript” package: you run “npm install typescript” and then invoke it via “node node_modules/typescript/bin/tsc“.

3. Compiler that comes with npm “tsc” package.

Compiler #1 seems to work, but it is not very good: it does not support –watch option (at least not on Windows), and it does not support wildcards or include/exclude directives in tsconfig.json, so you must name all files in your project explicitly. So, if you use Visual Studio Code->Command Palette->Configure Task Runner->TypeScript - Watch mode, generated task simply fails. It is a little funny to see a Microsoft product to work on Linux, but not on Windows.

Compiler #2 seems to be very, very old, don’t use it.

Compiler #3 is the one that works best, but it needs to be invoked with an arcane command line.

Bottom line: e pluribus unum may be a good thing in the long run, but it is very, very confusing when you are trying to familiarize yourself with a new technology.

Leave a Reply

Your email address will not be published. Required fields are marked *