From 52b4f09e58f796dd895539784b5f8117fd3df168 Mon Sep 17 00:00:00 2001 From: Dragoteryx <33252782+Dragoteryx@users.noreply.github.com> Date: Sun, 21 Apr 2019 09:34:12 +0200 Subject: [PATCH] fix(Structures): allow multiple extensions by checking prototype chain (#3217) --- src/util/Structures.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/Structures.js b/src/util/Structures.js index 5cdfc831a47f..2dc26770f254 100644 --- a/src/util/Structures.js +++ b/src/util/Structures.js @@ -55,8 +55,8 @@ class Structures { throw new TypeError(`The extender function must return the extended structure class/prototype ${received}.`); } - const prototype = Object.getPrototypeOf(extended); - if (prototype !== structures[structure]) { + if (!(extended.prototype instanceof structures[structure])) { + const prototype = Object.getPrototypeOf(extended); const received = `${extended.name || 'unnamed'}${prototype.name ? ` extends ${prototype.name}` : ''}`; throw new Error( 'The class/prototype returned from the extender function must extend the existing structure class/prototype' +