Issues are arising as I attempt to utilize a Proxy
. The structure of my class is as follows:
export class Builder {
public doSomething(...args: (string | number | Raw | Object)[]): this {
// Do stuff
return this
}
}
export class ModelBase extends Builder {
protected _items = {}
}
export class Model extends ModelBase {
public constructor(options?: ModelSettings) {
super(options)
return new Proxy(this, {
get: function (target, property) {
return target._items[property] || target
}
})
}
public static create() {
return new this()
}
}
Next, I extend Model
as shown below:
export class MyClass extends Model {
public constructor() {
super({/* Some options go here */})
// Do some stuff
}
public static getItems() {
let t = this.create()
t.doSomething()
}
}
Upon calling getItems()
which instantiates the class, an error occurs:
TypeError: t.doSomething is not a function
The doSomething()
method is located within the ModelBase
class. Disabling the Proxy
resolves the issue. Thus, I seek an explanation for the inability to access the parent class.