Visual Studio – TypeScript version problem

Visual Studio – TypeScript version problem

TypeScript project with Angular in Visual Studio – beginner problem
When you start writing your first project in TypeScript in Visual Studio you can notice some annoying behaviour. At first, you probably have installed TypeScript and configured project. Then you have started reading some tutorials. In my case, I started with tutorial: http://chsakell.com/2015/09/19/typescript-angularjs-gulp-and-bower-in-visual-studio-2015/
When I have started following this lessons, I noticed that hundreds of errors appears. Surprisingly, they were not in my code, but in Angular TypeScript definition file – angular.d.ts. I saw that it is a common problem, so I decided to describe my way to fix it.
typescript_errors
Solution for this problem is quite simple. The reason of errors is version’s differencies between  TypeScript compiler installed and definition files. To solve this, try to follow the steps listed below:
  1. Check on the typescript website http://www.typescriptlang.org/ number of the lastest version.
  2. Check version of TypeScript you have installed in Windows.
    It is usual located in C:Program Files (x86)Microsoft SDKsTypeScript. There could be many directories with version numbers. If you don’t have a current version installed, you should do this now.
  3. Check that PATH variable point this current version directory.
    You can also check that it works correctly in console using command

    tsc -v
  4. Then you should check the version of Typescript which is referenced in your project configuration (*.csproj) file. Open it in text editor and verify following line
    <TypeScriptToolsVersion>1.6</TypeScriptToolsVersion>
  5. The last step is to ensure, that you are using proper definition files. To do this, update all typings via NuGet package manager
    or
    you can do it in console (depend on the way, you setup them earlier)

    tsd update --save --overwrite