Typescript 1.4:Visual Studio 中错误的语法高亮
Typescript 1.4 最近发布,提供了新的可能性,例如联合.
Typescript 1.4 has been released recently, providing new possibilities like unions.
我为 Visual Studio 安装了新版本,但是语法突出显示无法识别联合:
I installed the new version for Visual Studio, however the syntax highlighting doesn't recognise unions:
var member: string|number;
虽然可以毫无问题地编译,但语法检查器会悬停在变量member
的定义和任何用法上.
Although it can be compiled without problems, the syntax checker hovers the definition and any usage of the variable member
.
我需要更新什么才能使其正常工作?
What do I need to update to get this working?
您可以将其配置为忽略分析 *.ts
文件中的错误,而不是关闭 Resharper.(Tools
-> Options
-> Resharper Options
-> Code Inspection
-> Settings
-> 要跳过的文件掩码
-> 添加 *.ts
)
Rather than turning off Resharper, you could configure it to ignore analysing errors in *.ts
files. (Tools
-> Options
-> Resharper Options
-> Code Inspection
-> Settings
-> File Masks to Skip
-> add *.ts
)
通过这种方式,您仍然可以从对其他文件使用 Resharper 中受益,并且您还可以从使用 Resharper 的 TypeScript 中获得代码格式等方面的好处.
This way you still benefit from using Resharper for other files, and you also get the benefits of code formatting and the like for TypeScript using Resharper.