common.js ファイルに次のメソッドがあります。「common.js」ファイルを typescript ファイルにインクルードすると、最初の行でコンパイル エラーが発生します。
これをどのように解決すればよいですか?
Function.prototype.method = function (name, func) {
///<summary>
///Create a new method if it not ready exists
///</summary>
if (!this.prototype[name]) {
this.prototype[name] = func;
return this;
}
};
String.method('trim', function () {
return this.replace(/^\s|\s+$/g, '');
});