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?
You will need to declare it in some way to make Typescript not complain, the easiest is to declare it as any:
But to get best intellisense support add info about the parameter types aswell: