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:
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.
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 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
  5. The last step is to ensure, that you are using proper definition files. To do this, update all typings via NuGet package manager
    you can do it in console (depend on the way, you setup them earlier)

    tsd update --save --overwrite

Sign up for free end-to-end testing training

Learn how to create end-to-end tests for your applications from the beginning to mobile testing
Email address


Get great contents delivered straight to your inbox everyday, just a click away, Sign Up Now.
Email address