Do I need to declare all my JQuery prototypes in a JQueryStatic definition file with typescript?

Posted by Marilou on Stack Overflow See other posts from Stack Overflow or by Marilou
Published on 2012-11-01T04:21:16Z Indexed on 2012/11/01 5:00 UTC
Read the original article Hit count: 150

Filed under:
|
|

I have the following code:

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

function addThemePrototypes() {
    var templateSetup = new Array();
    $.fn.addTemplateSetup = function(func, prioritary)
    {
        if (prioritary)
        {
            templateSetup.unshift(func);
        }
        else
        {
            templateSetup.push(func);
        }
    };
}

When I try to add the following:

  $('a').addTemplateSetup(

Into this same file I notice there is no intellisense and typescript does not seem to know about the addTemplateSetup prototype that I just added.

Is this the correct way for it to work or do I always need to add things like the definition for addTemplateSetup to an JQueryStatic definition file and then include that?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery