Commit 437fb2cb authored by Naoyuki Kanezawa's avatar Naoyuki Kanezawa Committed by Arunoda Susiripala

Copy all properties and descriptors when patching React (#1101)

* patch-react: copy non-enumerable properties and descriptors

* fix syntax error

* remove getOwnPropertyDescriptors polyfil
parent 2c85b367
......@@ -105,11 +105,11 @@ function wrap (fn, around) {
return around.call(this, fn, ...args)
}
// copy all properties
Object.assign(_fn, fn)
_fn.displayName = fn.displayName || fn.name
_fn.prototype = fn.prototype
for (const [k, d] of Object.entries(Object.getOwnPropertyDescriptors(fn))) {
try {
Object.defineProperty(_fn, k, d)
} catch (e) {}
}
_fn.__wrapped = fn.__wrapped = _fn
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment