Question

I am rewriting a large chunk of Javascript into Typescript and I have the jquery.d.ts file, which lets me do ajax calls etc, however I need to make my own descriptor for Qtip.

I thought it would be something like this:

interface JQuery
{
   qtip(options:any);
}

However this doesn't work, just keeps telling me that the method qtip doesnt exist on value of type JQuery.

So am I missing something? as I call it like so:

$("#some-element").qtip({some: "options"});
Était-ce utile?

La solution 2

Ends up this issue was down to the way I was building the project, I had 3 or 4 modules which were all interdependant. So the actual class which used this jquery extension reference was working fine. However when the subsequent files referenced the file without referencing the extension blew up but made it look like the problem was in the original file, not in the referencing file.

Autres conseils

In jquery.d.ts, the result of invoking $ is named JQuery, not Jquery. The naming here is case-sensitive.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top