MZ How to create an inherited class?

I am trying to create my own class that inherits from Window_Base, the problem is that it constantly throws an error that the constructor expects a rectangle object even though I have given it one.

While if I simply create a Window_Base object it does not throw any errors, so I would like to understand what is happening.
My class super simple
JavaScript:
class MyOwnWindow extends Window_Base {
    
    constructor() {
        super();
        

    };

    debugThisClass() {
        alert("Works")
    };
    

    
};


And the function I use to create it is this
JavaScript:
function makeTheWindow(){
    
    var myWindow = new MyOwnWindow(new Rectangle(10,10,200,300))
    var scene = SceneManager._scene;
      scene.addChild(myWindow);
    
}

What am I missing?
I don't know much about classes but have you tried adding an argument "rect" to your constructor which could then be passed onto your "super"?
constructor(rect) {
super(rect);
};
I don't know much about classes but have you tried adding an argument "rect" to your constructor which could then be passed onto your "super"?
constructor(rect) {
super(rect);
};
This was the problem exactly.
I don't know why I thought super(); it would automatically inherit everything

So putting rect or ...args solves the problem

Thanks a lot
Well, I think there are some syntax errors with your code, I have searched your query and found this code, can you replace your code with the below one:

Code:
class MyOwnWindow extends Window_Base {
    constructor(x, y, width, height) {
        super(x, y, width, height);
    }


    debugThisClass() {
        alert("Works");
    }
}


function makeTheWindow() {
    // Adjust the parameters accordingly
    var myWindow = new MyOwnWindow(10, 10, 200, 300);
    var scene = SceneManager._scene;
    scene.addChild(myWindow);
}

Thanks
@gulshan212 - maybe for MV, but this is for MZ. Different engine, different code.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-create-an-inherited-class.162898/