mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Copy all properties and descriptors when patching React (#1101)
* patch-react: copy non-enumerable properties and descriptors * fix syntax error * remove getOwnPropertyDescriptors polyfil
This commit is contained in:
parent
2c85b367ce
commit
437fb2cbd3
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue