I am attempting to extend the momentjs prototype with a new function. In JavaScript, I achieved this with the following code:
Object.getPrototypeOf(moment()).isWeekend = function() {
return this.isoWeekday() >= 6;
};
How can I accomplish this in TypeScript? I have been advised to duplicate the interface and add my function to it, but my attempt so far has not been successful:
module moment {
interface Moment {
isWeekend(): boolean
}
Moment.prototype.isWeekend = () => {
this.isoWeekday() >= 6;
};
}