This project is read-only.

How to convert these methods

Topics: General
Dec 9, 2012 at 5:24 PM


I have following methods in a common.js file.  I get a compilation error on the first line when i include the "common.js" file into a typescript file.

How should I solve this ?

Function.prototype.method = function (name, func) {
    ///Create a new method if it not ready exists
    if (!this.prototype[name]) {
        this.prototype[name] = func;
        return this;

String.method('trim', function () {
    return this.replace(/^\s|\s+$/g, '');