From a592883a2eba52ba18876989acf939d12fa61fd3 Mon Sep 17 00:00:00 2001 From: AAGaming Date: Wed, 17 Aug 2022 15:18:45 -0400 Subject: [PATCH] fix(utils): allow prop reassigns to fail --- src/utils.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/utils.ts b/src/utils.ts index bfe5a07..5794c03 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -90,10 +90,14 @@ export function wrapReactClass(node: any, prop?: any) { const cls = node[prop || "type"]; const wrappedCls = class extends cls {}; Object.getOwnPropertyNames(cls.prototype).forEach((prop: any) => { - wrappedCls.prototype[prop] = cls.prototype[prop] + try { + wrappedCls.prototype[prop] = cls.prototype[prop] + } catch (e) {} }); Object.getOwnPropertyNames(cls).forEach((prop: any) => { - if (prop != "prototype") wrappedCls[prop] = cls[prop] + try { + if (prop != "prototype") wrappedCls[prop] = cls[prop] + } catch (e) {} }); wrappedCls.prototype.__proto__ = cls.prototype.__proto__; return node[prop || "type"] = wrappedCls;