0

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?

1 Answer 1

1

I finally found it - it simply was a circular reference causing that error. See: https://requirejs.org/docs/api.html#circular

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.