Disallow object assign explanation
Summary: > Explain the **motivation** for making this change. What existing problem does the pull request solve? Provides better documentation for a confusing (and common) error message. Solves https://github.com/facebook/react-native/issues/3634 > **Test plan (required)** This is just an error message shown in dev environment. I ran the tests and they pass. Closes https://github.com/facebook/react-native/pull/10472 Differential Revision: D4053818 Pulled By: hramos fbshipit-source-id: e80dc6ab787a8d8cabbcb442c438c07269401ff7
This commit is contained in:
parent
ad95aea51d
commit
f25e422417
|
@ -15,6 +15,7 @@
|
|||
|
||||
// WARNING: This is an optimized version that fails on hasOwnProperty checks
|
||||
// and non objects. It's not spec-compliant. It's a perf optimization.
|
||||
// This is only needed for iOS 8 and current Android JSC.
|
||||
/* eslint strict:0 */
|
||||
Object.assign = function(target, sources) {
|
||||
if (__DEV__) {
|
||||
|
@ -55,7 +56,8 @@ Object.assign = function(target, sources) {
|
|||
if (!hasOwnProperty.call(nextSource, key)) {
|
||||
throw new TypeError(
|
||||
'One of the sources for assign has an enumerable key on the ' +
|
||||
'prototype chain. This is an edge case that we do not support. ' +
|
||||
'prototype chain. Are you trying to assign a prototype property? ' +
|
||||
'We don\'t allow it, as this is an edge case that we do not support. ' +
|
||||
'This error is a performance optimization and not spec compliant.'
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue