如何从javascript中的构造函数继承?
例如,我有一个用原生 js 编写的基类
var MyModule;
(function (MyModule) {
var MyBase = (function () {
function MyBase(container, $MyElement) {
this._container = container;
this._$MyElement = $MyElement;
}
MyBase.prototype.toString = function () {
return this._previewType;
};
MyBase.prototype.method1 = function(){
};
MyBase.prototype.method2 = function () {
return this._isPreviewAffected;
};
return MyBase;
})();
MyModule.MyBase = MyBase;
})(MyModule || (MyModule = {}));
我如何在打字稿中继承它。我尝试了以下代码。我收到错误“引用不正确:引用的文件:“my-base.js”无法解析“
/// <reference path="my-base.js" />
module MyModule {
export class MyConcrete extends MyBase {
}
}