Fix dev-only redbox in polyfillfunctions

Summary: Fixes a redbox about setting both the accessor and the value for an object. It looks like it's actually coming from PolyfillFunctions, where we set the value as well as spreading in the object descriptor for modules in DEV.

Reviewed By: yungsters

Differential Revision: D9792991

fbshipit-source-id: a2fa5d1820c5eddfd8244722771e76de62f89976
This commit is contained in:
Emily Janzer 2018-09-12 16:19:49 -07:00 committed by Facebook Github Bot
parent 737f93705c
commit ab97b9f602

View File

@ -33,10 +33,7 @@ function polyfillObjectProperty<T>(
const descriptor = Object.getOwnPropertyDescriptor(object, name);
if (__DEV__ && descriptor) {
const backupName = `original${name[0].toUpperCase()}${name.substr(1)}`;
Object.defineProperty(object, backupName, {
...descriptor,
value: object[name],
});
Object.defineProperty(object, backupName, descriptor);
}
const {enumerable, writable, configurable} = descriptor || {};