How to extend external framework's d.ts (jQuery) without modifying the original?

typescript

Solution

I found out that there is nothing preventing me from adding new methods to the original classes, so in the jquery-extend.d.ts I simply declare:

interface JQueryStatic {
    farbtastic(element : string, callback? : Function) : Farbtastic;
}

interface JQuery {
    farbtastic(element : string, callback? : Function) : void;
}

interface Farbtastic {
    linkTo(callback : Function) : void;
    setColor(color : string) : void;
}

Hope this will help someone one day.

Problem

I am using jQuery and it's definitions from Definitely Typed collection. I want to extend it with a Farbtastitc color picker that ads new methods directly to JQueryStatic, for instance: ``` $.farbtastic(placeholder) ``` I don't want to modify the original `jquery.d.ts` file to add this method, instead I would like to create something like `jquery-extend.d.ts` with the added methods.

Original source

Related problems