用于 Visual Studio 2017 的 TypeScript 1.8 [英] TypeScript 1.8 for Visual Studio 2017

查看:31
本文介绍了用于 Visual Studio 2017 的 TypeScript 1.8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Visual Studio 2015 中创建了一个使用 TypeScript 1.8 的项目.安装Visual Studio 2017后,我尝试在新IDE中打开旧项目.如果我检查项目的属性,我会得到这个:

I have a project created in Visual Studio 2015 which using TypeScript 1.8. After installing Visual Studio 2017, I tried to open the old project in the new IDE. If I check properties of the project, I get this:

TypeScript 版本:1.8(不可用).

TypeScript version: 1.8 (unavailable).

但是,我可以看到这个版本已经在C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.8下.

However, I can see that this version is already under C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.8.

我不想使用较新的版本,因为我现在不想更改代码.

I don't want to use a newer version because I don't want to change the code right now.

Visual Studio 2017 是否支持 TypeScript 1.8?

Does Visual Studio 2017 support TypeScript 1.8?

如何使此版本可用于 VS 2017?

How can I make this version available to VS 2017?

推荐答案

我通过安装Microsoft.TypeScript.MsBuild.所以对我们来说是 1.8.11 版本.

I was able to solve this problem by installing the corresponding version nuget package of Microsoft.TypeScript.MsBuild. So for us it is version 1.8.11.

TypesScript 版本仍然显示不可用",并且仍然显示一些智能感知错误.但是,该项目可以正常构建和运行.

The TypesScript version still says 'unavailable' and there are still some intellisense errors shown. However, the project builds and runs properly.

或者,如果用户想要更高版本.Microsoft 提供了一些版本工具作为 Visual Studio 扩展(例如 2.7 版 https://marketplace.visualstudio.com/items?itemName=TypeScriptTeam.typescript-27-vs2017)

Alternatively, if a user wants a higher version. Microsoft makes some version tooling available as a visual studio extension (e.g. version 2.7 https://marketplace.visualstudio.com/items?itemName=TypeScriptTeam.typescript-27-vs2017)

更新:我已经找出了智能感知错误.您可以转到工具">扩展和更新"并为高于 2.6 的版本安装打字稿工具.然后你可以用//@ts-ignore 抑制注释描述 这里

UPDATE: I have figured out the intellisense errors. You can go to Tools > Extensions and Updates and install typescript tools for a version greater than 2.6. Then you can you the //@ts-ignore suppression comments described here

旁注:我没有运气解决智能感知错误.我试过了

Side note: I did not have any luck resolving the intellisense errors. I tried

  • 为 1.8 安装 Microsoft.TypeScript.Compiler nuget 包
  • 安装各种版本的 TSLint nuget 包
  • 安装 TSLint.MSBuild nuget 包
  • 安装 TypeScript Analyzer(TSLint 的静态分析扩展)

这篇关于用于 Visual Studio 2017 的 TypeScript 1.8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆