Skip to content

Commit

Permalink
fix(utils): allow prop reassigns to fail
Browse files Browse the repository at this point in the history
  • Loading branch information
AAGaming00 committed Aug 17, 2022
1 parent 3f126fe commit a592883
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a592883

Please sign in to comment.