mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 20:13:30 +01:00
fix(Structures): allow multiple extensions by checking prototype chain (#3217)
This commit is contained in:
@@ -55,8 +55,8 @@ class Structures {
|
|||||||
throw new TypeError(`The extender function must return the extended structure class/prototype ${received}.`);
|
throw new TypeError(`The extender function must return the extended structure class/prototype ${received}.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const prototype = Object.getPrototypeOf(extended);
|
if (!(extended.prototype instanceof structures[structure])) {
|
||||||
if (prototype !== structures[structure]) {
|
const prototype = Object.getPrototypeOf(extended);
|
||||||
const received = `${extended.name || 'unnamed'}${prototype.name ? ` extends ${prototype.name}` : ''}`;
|
const received = `${extended.name || 'unnamed'}${prototype.name ? ` extends ${prototype.name}` : ''}`;
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'The class/prototype returned from the extender function must extend the existing structure class/prototype' +
|
'The class/prototype returned from the extender function must extend the existing structure class/prototype' +
|
||||||
|
|||||||
Reference in New Issue
Block a user