Search code examples
visual-studio-2013typescripttypescript1.8

Why typescript doesn't compile in VS2013 on another person's machine?


we have a VS2013 project that uses typescript. It compiles just fine on my machine, but when another developer opens the same project (EXACTLY SAME) and tries to build it, there are tons of error message related to typescript:

enter image description here

However, as I said, on my machine - no problems at all, Everything compiles just fine.

We all have Typescript for Visual Studio 2013 installed, the latest version 1.8.3 I believe. Any idea whats going on?


Solution

  • As far as I understand VS has nothing to do with TS installed by NPM. (You may notice after you install TS using NPM, there is no tsc.exe file). VS targets only tsc.exe installed by TS for VS extension, which installes TS to c:\Program Files (x86)\Microsoft SDKs\TypeScript\X.Y. You may have multiple folders under c:\Program Files (x86)\Microsoft SDKs\TypeScript. Set TypeScriptToolsVersion to the highest version installed. In my case I had folders "1.0", "1.7", "1.8", so I set TypeScriptToolsVersion = 1.8, and if you run tsc - v inside that folder you will get 1.8.3 or something, however, when u run tsc outside that folder, it will use PATH variable pointing to TS version installed by NPM, which is in my case 1.8.10. I believe TS for VS will always be a little behind the latest version of TS you install using NPM. But as far as I understand, VS doesnt know anything about TS installed by NPM, it only targets whateve versions installed by TS for VS extensions, and the version specified in TypeScriptToolsVersion in your project file.