I am trying to set up some "modules" in typescript for my site, and I am getting both conflicting information - and conflicting results. For example, I have three "classes". Prototype
, Item
, and Tag
. They all three need to have a specific set of properties, so I decided to make this a base class ComponentModel
, which looks like this.
module website.admin.components {
export class ComponentModel {
public Components = { // define property };
}
}
now, I want to inherit this class in my other three, so I started with 'tags'.
module website.admin.viewModels {
export class Tag extends website.admin.components.ComponentModel {
// tag specific properties
constructor() { super(); } // initialize the base class as required
}
}
Okay, this seems to work. But the exact same code on the Prototype
class does not work;
module website.admin.viewModels {
export class Prototype extends website.admin.components.ComponentModel {
// prototype specific properties
constructor() { super(); }
}
}
This just causes all kinds of strange behavior, and refuses to work at runtime. I get the following errors;
Uncaught TypeError: Cannot read property 'ComponentModel' of undefined
Uncaught TypeError: Cannot read property 'prototype' of undefined
Uncaught TypeError: undefined is not a function
Can anyone help me figure out why this is functioning like this? And what I can do to stop it? It is getting dreadfully irritating.