How to install TypeScript 2.2 onto Visual Studio 2017
Asked Answered
F

1

12

Some people in our team have both Visual Studio 2015 and Visual Studio 2017 installed. Others only have the latest Visual Studio 2017 (15.5). With the latter, we noticed that our TypeScript project in the IDE is generating all kinds of unexpected errors due to all kinds of lib.es2015.d.ts issues.

Our projects use TypeScript 2.2, whereas the latest Visual Studio 2017 (15.5) comes with TypeScript 2.5.

We discovered that the Visual Studio TypeScript SDK is installed in the following path:

  • C:\Program Files (x86)\Microsoft SDKs\TypeScript\2.2
  • C:\Program Files (x86)\Microsoft SDKs\TypeScript\2.5

We noticed that 15.5 comes with a new property in the csproj property screen which allows direct mutation of the wanted TypeScript version. As the project requires 2.2 which is not installed, the dropdown states the missing 2.2 bits.

What we have tried to fix this:

  1. Installed the TypeScript 2.2 SDK for Visual Studio 2015 (for 2017 there is no separate install). Unfortunately it looks like this package does not come with the language service tsserver.js. Did not work. Url: http://download.microsoft.com/download/6/D/8/6D8381B0-03C1-4BD2-AE65-30FF0A4C62DA/TS-2.2-dev14update3-20170221.2/TypeScript_Dev14Full.exe
  2. Played with the NuGet-package Microsoft.TypeScript.Compiler and installed 2.2.1 (no 2.2.2 available?). This didn't seem to solve anything. Not clear to us how this package really integrates into something. Even after adding the specific property TypeScriptNuGetToolsVersion.
  3. Played with the NuGet-package Microsoft.TypeScript.MSBuild and installed version 2.2.2. Unfortunately, this only influences the MSBuild process and not the editor experience. MSBuild is not relevant to us as we are using the Angular CLI for really building / watching the TypeScript source code.
  4. Copied over the 2.2 bits of one of our Visual Studio 2015 installations. This enabled the 2.2 menu option in the csproj property screen. But, we still experience clashes with lib.es2015.d.ts. What we discovered is that the SDK seems to always use the latest version, in our case 2.5. We also installed 2.6, and then it started to use 2.6.
  5. Ultimately we just removed the 2.6 folder completely and created a copy of the 2.2 folder with the name 2.6. And now it works. But this really feels like a hack!

To summarize our questions:

  • What is the best way to install TypeScript SDK 2.2 onto Visual Studio 2017 (15.5)?
  • What is the best way to really enforce the usage of lib.es2015.d.ts from version 2.2?
Fatback answered 21/12, 2017 at 15:36 Comment(0)
D
17

In "Get Tools and Features" under the Tools menu you should be able to install different versions of TypeScript under the individual components tab.

Daddy answered 21/12, 2017 at 15:48 Comment(4)
Thanks, this works! After installing TypeScript SDK 2.2 through this route suddenly Visual Studio 2017 takes lib.es2015.d.ts from the 2.2 version as well!Palmore
I'm an install hog, I usually install everything hehe.Daddy
It's weird that some components are in the Visual Studio installer and others (like .NET Core 2.2 (as of the time I post this comment) you have to get on microsoft.com to getYancey
In Visual Studio 2017 15.9.6 TypeScript 2.2 not listed. Under Tools | Get Tools and Features , which launches Visual Studio Installer | Individual Components tab | SDKs, libraries, and frameworks | check TypeScript 2.2 SDKGranoff

© 2022 - 2024 — McMap. All rights reserved.