0

I thought this would be a simple base and child class task but this error is throwing me.

I created a base class like this:

module A.B.C {

   export class instructionBase {

      constructor(
      var1: class1,
      var2: class2,
      ...etc for 10 injected classes) { //init code }
   
      method1(){}

      method2(){}
   }
}

My inherited class is like this:

namespace A.B.C {

   export class instructionComponent extends instructionBase {

      static $inject = ["", "", ""...for 10 times]

      constructor(
         var1: class1,
         etc for 10 times) {
         
         super(var1, for 10 times)
         }
   }

   // Register the component
   angular.module("myApp.abc")
    .component("instructioncomponent", {
        templateUrl: "/.../instruction.component.html",
        controllerAs: "vm",
        transclude: true,
        controller: instructionComponent 
    });

}

At run time I get this error:

Uncaught TypeError: Object prototype may only be an Object or null: undefined at setPrototypeOf () at __extends (someOtherClassICreatedALongTimeAgo.js:6) at instrumentComponent.ts:4 at A.B.C (instrumentComponent.ts:4) at A.B.A.B(instrumentComponent.ts:45) at A (instrumentComponent.ts:45) at instrumentComponent.ts:45

What's interesting to me is that on line 6 of the error the namespace repeats twice partially. Do I have an unintended circular reference?

Looking at this class (someOtherClassICreatedALongTimeAgo) from the error it also extends a base class so I must have wires crossed somewhere.

1 Answer 1

1

Most likely at the time you try to extend instructionBase it is undefined. That would be my guess. If you want to be sure about this try putting it in a same file

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

1 Comment

This was a useful diagnostic tip. The ultimate solution was that I had forgotten to add my base class to bundle config so yeah...it was undefined.

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.