Reputation: 36166
let's say you have a date_ext.js
with functions:
Date.prototype.getMyBlaDate = function() {
return // bla bla
};
Date.minutesBetween = function (date1, date2) {
return // obladi-oblada
}
You don't want to convert entire file into typescript but you still can use the methods from it. Let's create a definition for typescript
interface Date{
getMyBlaDate():BlaBlaType;
minutesBetween(date1:Date, date2:Date):ObladiType;
}
it will work for prototyped method but not for the static one. How do you define static method?
Upvotes: 2
Views: 539
Reputation: 311885
From looking at lib.d.ts
is appears you would use:
declare var Date: {
minutesBetween(date1:Date, date2:Date):ObladiType;
}
UPDATE
Looks like it's not currently supported; see http://typescript.codeplex.com/discussions/403971
Upvotes: 2