Currently I'm working quite a lot with TypeScript both on my Angular courses and also on projects for customers.

So today I decided to play around with the new and shiny TypeScript 2.1 version, but there was a (very annoying) mismatch between the intellisense and compiler messages in Visual Studio Code and from the typescript compiler.

Errors in Visual Studio Code:
visual studio code messages

And the correct one in tsc v2.1.4:
compiler message

The example uses the new Mapped Types features in TypeScript. More info here:

As it turns out Visual Studio Code comes with it's own version of the typescript language service installed, which is not up-to-date yet with the latest version of the TypeScript language.

Luckily we can changed that!

The menu under File > Preferences (Code > Preferences on Mac) provides entries to configure user and workspace settings.
When you select User settings, a window will open with all the defaults and a 'settings.json' file will be opened.

In this file you can add:

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

where the second part points to your typescript installation, which of course is different if you run Windows. (If you look in the default settings under 'TypeScript'"typescript.tsdk" you will find that this setting is 'null', meaning: use the built in version)

After setting this option and restarting Visual Studio Code, it will use the system installed version of typescript and the mismatch is gone!

Happy typescripting! :-)