Ever since I updated to the latest jQuery.d.ts
definition file, using the Visual Studio NuGet package manager, I now get 100s of errors within the jQuery.d.ts file.
The pattern to all the errors is vertical lines like this:
index(selector: string|JQuery|Element): number;
which I assume indicates optional types. The errors mostly look like:
\Scripts\typings\jquery\jquery.d.ts(2797,34): error TS1005: Build: ',' expected.
The default Build Action was TypeScriptCompile
, but changing that to none
has no effect.
I am running Visual studio 2013 Professional release 4, so assumed I would have the latest TypeScript version, but this looks like a versioning issue.
Any ideas on how to resolve the problem.
When you have an existing VS 2013 project that used an earlier version of TypeScript and you want to upgrade to the latest nuGet packages of jquery.d.ts or knockout.d.ts, installation of the latest TypeScript compiler is not enough.
After installing the latest TypeScript from
https://visualstudiogallery.msdn.microsoft.com/2d42d8dc-e085-45eb-a30b-3f7d50d55304
you need to edit project definition files to turn on version 1.4 features. This is done by changing the line <TypeScriptToolsVersion>1.0</TypeScriptToolsVersion>
to <TypeScriptToolsVersion>1.4</TypeScriptToolsVersion>
Also, please be aware that your TS code may require some changes too. Specifically, FormData constructor does not take HTML element as an argument anymore. The simplest workaround is to change code like this one: var formData = new FormData(<HTMLFormElement>$("#form")[0]);
to var formEl = <HTMLFormElement>$("#form")[0]; var formData = new window['FormData'](formEl);
TypeScript was updated (Jan 2015) after Visual Studio 2013 release 4 (Nov 2014):
You can get the latest TypeScript compiler here: https://visualstudiogallery.msdn.microsoft.com/2d42d8dc-e085-45eb-a30b-3f7d50d55304
Additionally you may have to update the TypeScriptToolsVersion
setting in any old csproj files:
They may currently look like this:
<TypeScriptToolsVersion>1.0</TypeScriptToolsVersion>
change to 1.4 for VS 2013 release 5:
<TypeScriptToolsVersion>1.4</TypeScriptToolsVersion>
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