MZ JS type error

I tried to play around with the js game files to modify the item menu, but I messed it up a little and now I'm getting this error:
Screenshot 2023-11-08 112137.png


The code doesnt give me any errors but the error message insists:


Code:
Window_ItemCategory.prototype.makeCommandList = function() {
    if (this.needsCommand("item")) {
        this.addCommand(TextManager.item, "item");
    }
    if (this.needsCommand("weapon")) {
        this.addCommand(TextManager.weapon, "weapon");
    }
    }
    if (this.needsCommand("keyItem")) {
        this.addCommand(TextManager.keyItem, "keyItem");
    }
;



Thanks in advance <3
first, do not modify the base files directly - make all changes into a plugin to override the default files instead.

And what exactly is your problem with the error message?
It tells you that "needsCommand", a function that you tried to use, does not exist - at least not in that specific context.
So you'll need to check where "needscommand" is defined to confirm where it can be used - or to write it yourself if it isn't defined anywhere.
Solved it. My bad I found the function and paste it in the proper place. I just panicked a little and came here. SOLVED
first, do not modify the base files directly - make all changes into a plugin to override the default files instead.

And what exactly is your problem with the error message?
It tells you that "needsCommand", a function that you tried to use, does not exist - at least not in that specific context.
So you'll need to check where "needscommand" is defined to confirm where it can be used - or to write it yourself if it isn't defined anywhere.
even if you hardcode the function, the "this.needsCommand()" can come invalid
as you didn't code that.
alias the function if needed to avoid those kind of issues ^^
Found some incorrect brackets

Code:
Window_ItemCategory.prototype.makeCommandList = function() {
if (this.needsCommand("item")) {
this.addCommand(TextManager.item, "item");
}
if (this.needsCommand("weapon")) {
this.addCommand(TextManager.weapon, "weapon");
}
} <-- this needs to be removed
if (this.needsCommand("keyItem")) {
this.addCommand(TextManager.keyItem, "keyItem");
}
} <-- inserted bracket
;

Original thread: https://forums.rpgmakerweb.com/threads/js-type-error.162748/