3

Possible Duplicate:
Using jQuery plugin in TypeScript

So I'm making a webApp with the typescript, I already made the webapp in JavaScript and now I want to do it in typescript,

in this webapp I need a few jQuery libraries like a standard jQuery and jQuerySVG, the jQuery.d.ts can be found easily and I can just reference it to the typescript, the problem is that jQuerySVG, I can't find the typescript version for jquery.svg.js (like jQuery.svg.d.ts)

so how can I work this out?

or will the typescript work if I just reference the jQuery.svg.js in the script tag on my html file?

Community
  • 1
  • 1
Eldon Lesley
  • 915
  • 6
  • 19
  • 38

1 Answers1

5

You will need to generate this file yourself. Its fairly simple to document the functions that you are using in your code by writing the d.ts file.
Update: Looking at the svg documentation, you are looking for a jquery.svg.d.ts file that uses the JQuery selector:

// from documentation on svg:
//$(selector).svg(loadURL) 
//$(selector).svg(onLoad) 
//$(selector).svg('get') // Retrieve SVG wrapper 
//$(selector).svg('destroy') // Remove SVG functionality 

// this is what you need to put in your jquery.svg.d.ts
interface JQuery {
    svg(loadUrl: string): JQuery;
    svg(x: Function): JQuery;
}

Then you will be able to write statements like this:

$('selector').svg('testLoadUrl');

$('selector').svg(() => {
    // function call
});

$('selector').svg('get');  
user229044
  • 232,980
  • 40
  • 330
  • 338
blorkfish
  • 21,800
  • 4
  • 33
  • 24