TypeScript AMD模块继承不工作
我有一堆类型脚本文件,它们使用TypeScript AMD模块继承不工作,typescript,inheritance,requirejs,Typescript,Inheritance,Requirejs,我有一堆类型脚本文件,它们使用扩展继承。例如: export class AdminModule extends ModuleBase { constructor(moduleData: IModuleData) { super(moduleData); } } 它们是使用以下tsconfig.json构建的: { "compileOnSave": false, "compilerOptions": { "module": "amd",
扩展
继承。例如:
export class AdminModule extends ModuleBase {
constructor(moduleData: IModuleData) {
super(moduleData);
}
}
它们是使用以下tsconfig.json
构建的:
{
"compileOnSave": false,
"compilerOptions": {
"module": "amd",
"noImplicitAny": false,
"removeComments": true,
"preserveConstEnums": true,
"alwaysStrict": true,
"sourceMap": false,
"target": "es5",
"typeRoots": [
"Typings/**/*"
]
},
"include": [
"App/**/*"
]
}
编译器将此脚本包含到所有继承某些内容的文件中
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
}
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
现在我试图用requirejs加载所有内容,但在extendStatics(d,b)行中出现以下错误代码>
TypeError:Object.setPrototypeOf:应为对象或null,未定义
查看堆栈跟踪,基类似乎尚未加载且未定义。我做错了什么?我终于找到了它——它只是一个循环引用导致了那个错误。
见: