Getting Visual Studio Code To Work With Next Versions of TypeScript

Recently whilst helping out a client with an Aurelia TypeScript project, I encountered a situation where the latest development version of TypeScript 2.0 was being used, but some of the newer features like filesGlob support were not being picked up. Module resolution and other things were also an issue.

Turns out you can configure Visual Studio Code to use a local version of TypeScript through a setting directive inside of a project settings file.

Firstly, make sure you have TypeScript installed in your project, I installed via npm install typescript@next -D which saves it as a development dependency.

The best way to make sure this works in your project is to create a folder (if it doesn’t already exist) called .vscode and inside there create a file (if it doesn’t already exist) called settings.json and put the following inside of the curly braces:

"typescript.tsdk": "./node_modules/typescript/lib"

This will then ensure that your Visual Studio Code editor uses your locally installed version of TypeScript opposed to an internal version of it which could be out of date.

2 responses to “Getting Visual Studio Code To Work With Next Versions of TypeScript”

  1. Denis Carriere says:

    Thanks for this post! Really appreciate it, I was scratching my head for an hour trying to figure this out.

    It worked! Woot!

  2. pyros2097 says:

    Same thing with me. Was getting a lint error in Promise.resolve.

Leave a Reply

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