mirror of
https://github.com/danbulant/discord.js
synced 2026-06-08 17:21:31 +00:00
fix(Structures): allow multiple extensions by checking prototype chain (#3217)
This commit is contained in:
parent
1514df0f87
commit
52b4f09e58
1 changed files with 2 additions and 2 deletions
|
|
@ -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' +
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue