8

I'm new to TypeScript, when include jquery.d.ts getting many syntax errors while building the code, I'm using VS express 2012. To include the jQuery definition I have use the following code:

/// <reference path="./jquery.d.ts" />

I get a lot of errors just from the definition file - such as this:

Error   109 Index signature parameter type must be 'string' or 'number'.    D:/Able/TypeScript/HelloWorld/HelloWorld/jquery.d.ts    54  20  HelloWorld

Here is the screen shot of error...

enter image description here

Why is the definition file generating errors?

6
  • 1
    Can you show us that line so we can help? Commented Jul 3, 2013 at 20:16
  • may I know why this question is off-topic? Commented Jul 4, 2013 at 7:19
  • @SteveFenton I'm getting the error when compile the code, do I need to post the jQuery file code? Commented Jul 4, 2013 at 7:54
  • Where did you get the jquery.d.ts file from? Commented Jul 4, 2013 at 7:56
  • typescript.codeplex.com/SourceControl/changeset/view/… Commented Jul 4, 2013 at 7:56

1 Answer 1

11

The TypeScript definition you have won't work in the TypeScript 0.9 compiler.

You can get the latest version from either...

Codeplex or Definitely Typed

You'll notice that the indexers are updated from:

headers?: { [key: any]: any; };

To

headers?: { [key: string]: any; };

This is to comply with tighter compiler rules that state the key must be a string or a number.

Sign up to request clarification or add additional context in comments.

1 Comment

Great help and support. Thank You. You are awesome :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.