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.
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:
- Check on the typescript website http://www.typescriptlang.org/ number of the lastest version.
- 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.
- Check that PATH variable point this current version directory.
You can also check that it works correctly in console using command
- 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
- 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