Reputation: 193
I've got a bunch of TypeScript files which use extends
inheritance. Example:
export class AdminModule extends ModuleBase {
constructor(moduleData: IModuleData) {
super(moduleData);
}
}
They are built with the following tsconfig.json
:
{
"compileOnSave": false,
"compilerOptions": {
"module": "amd",
"noImplicitAny": false,
"removeComments": true,
"preserveConstEnums": true,
"alwaysStrict": true,
"sourceMap": false,
"target": "es5",
"typeRoots": [
"Typings/**/*"
]
},
"include": [
"App/**/*"
]
}
The compiler includes this script to all files which inherit something.
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 __());
};
})();
Now I'm trying to load everything with requirejs, but I get the following error at the line extendStatics(d, b);
.
TypeError: Object.setPrototypeOf: expected an object or null, got undefined
Looking at the stack trace, it seems that the base class has not been loaded and is undefined. What am I doing wrong?
Upvotes: 0
Views: 149
Reputation: 193
I finally found it - it simply was a circular reference causing that error. See: https://requirejs.org/docs/api.html#circular
Upvotes: 1