Typescript errors in Visual Studio Code

So I am a huge fan of Visual Studio Code and have been using it exclusively for all web & SharePoint development. Over the weekend I decided to look into Typescript a little bit more since I have heard a few speakers talk about how it really addresses some of the shortcomings of JavaScript such as coercion.

However, the one thing that you need to understand about Typescript is that it is a compiled language versus JavaScript which is interpreted. What that means for you as a modern web developer – you will need to have a step in your workflow process that involves compiling TypeScript into JavaScript for use in your application.

My development environment is a Windows machine running Node.js and of course Visual Studio Code. I created a build task which includes an action to compile the JavaScript to Ecmascript 5. When I ran the build task it spit out 2 Typescript errors.

I brought up a command prompt to make sure that it was installed globally – I typed tsc -v which is a version check command. It came back with 1.0.3 which is a really old version of Typescript. This was strange because I had loaded a new version using npm so there was no reason why it would be pulling down an old version. Then it hit me..

So I peeked at my environment variables and noticed there was an entry already for Typescript.


It most likely came when I installed the full Visual Studio IDE.

I deleted this reference and then did a reboot, and everything started to work as expected! So if you’re ever getting funky errors when compiling Typescript to JavaScript, you might want to make sure you are pointing at the right version of Typescript.


Leave a Reply