Typescript 1.4 has been released recently, providing new possibilities like unions.
I installed the new version for Visual Studio, however the syntax highlighting doesn't recognise unions:
var member: string|number;
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?
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
)
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.
I was having a similar issue where Resharper was not recognizing the "const" keyword.
I fixed this by explicitly telling Resharper what version of TypeScript to use. By default it is set to "auto detection".
On the menu, go to Resharper > Options > Code Editing > TypeScript.
Change the Type Script Language Level to "1.5 (experimental)"
I've had the same issue, and for me it was Resharper that was causing the problem.
If you have Resharper installed then simply disable it while working on TypeScript 1.4, at least until JetBrains releases an update with 1.4 support.
To disable Resharper:
Tools -> Resharper -> General -> Suspend
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With