user6806234 user6806234 - 4 years ago 118
TypeScript Question

How to manage solutions that require different versions of typescript in visual studio?

I've read about scenarios where a dev needed to downgrade their typescript in order for it to support a particular npm package version.

Can this be done with Visual Studio? I recently downloaded a sample solution which used angular2 npm package. The solution compiled without issue with the version of TypeScript that was installed in my instance of VS. I think the previous TypeScript version was 1.8.2.

However, after I downloaded and installed the latest version of TypeScript in my VS the angular2 beta sample solution had compilation errors. I think the updated version of TypeScript that I downloaded/installed was 2.0.1.

I could see a scenario where I have 2 different solutions: 1 solution which uses angular2 beta and 1 solution which uses @angular2 final. I would need the latest version of TypeScript installed in VS to support @angular2 final but this means that the solution written in angular2 beta wouldn't compile.

Any idea how I would manage this scenario?

Answer Source

Each project file can specify it's own typescript version. Though I'd recommend fixing the issues, providing a pull request, abandoning packages that don't stay up to date.

The Property in MsBuild that governs this setting is

<TypeScriptToolsVersion>1.8</TypeScriptToolsVersion>

See also:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download