Reputation: 4123
I have a basic MVC4 web project in VSTS 2012 to play around with TypeScript.
I installed this version of TypeScript: TypeScriptSetup.0.8.1.msi
I have the jquery.d.ts file from: http://typescript.codeplex.com/SourceControl/changeset/view/fe3bc0bfce1f#typings%2fjquery.d.ts
I am getting compile errors on all "index signature" definitions. The first compile error is with the JQueryAjaxSettings:
headers?: { [key: any]: any; };
Here is the error:
Error 9 Index signatures may only take 'string' or 'number' as their parameter
C:\Development\TypeScript\ScriptGen\ScriptGen.Web\Scripts\jquery.d.ts 37 18 app.ts
The compiler doesn't like the key defined as type any.
Should I change the key type to string or is there something else I am missing?
Upvotes: 3
Views: 3973
Reputation: 220994
You're using an old version of jquery.d.ts. The compiler has changed since then to disallow any
indexers. Any newer version of jquery.d.ts (e.g. this one) will work fine, or you can just change that any
to string
if you like (there have been multiple other fixes in that file in the interim you might want, though).
Upvotes: 7