TypeScript AMD 模块继承不起作用

TypeScript AMD module inheritance not working

我有一堆使用 extends 继承的 TypeScript 文件。示例:

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: expected an object or null, got undefined

查看堆栈跟踪,似乎基础 class 尚未加载且未定义。我做错了什么?

我终于找到了 - 它只是导致该错误的循环引用。 参见:https://requirejs.org/docs/api.html#circular