Rayjax
Rayjax

Reputation: 7784

TypeScript Intellisense and jQuery problems

I am using VS 2012 and TypeScript with jquery. I am converting an existing JS app into TS and I have the following problem :

$(window).load(function () {
//stuff
});

$(window).load got underlined and error is 'supplied parameters do not match any signature of call target'. I am using jquery 1.7.2 with this jquery.d.ts jquery ts annotations. I added the reference link on top of the file.

What am I doing wrong ?

Edit : I have got typescript installed in VS of course, and it doesn't change anything to edit the argument, it can be "window" or anything else, it keeps making the error. The definition of load() it expects is (url:string, data: any, complete: any) while in jQuery doc it's just a function..

Upvotes: 1

Views: 848

Answers (1)

samjudson
samjudson

Reputation: 56853

The Typescript definition only contains the definition for 1 particular version of the load function, the one that loads html from a url http://api.jquery.com/load/. Typescript is still in alpha don't forget.

This shouldn't affect your use of Typescript, except you will continue to receive the warning.

As an alternative you could change your code to something like the following:

$(window).on("load", function() {
    /// so stuff
});

Upvotes: 2

Related Questions