diff --git a/packages/react-dom/src/__tests__/ReactCompositeComponent-test.js b/packages/react-dom/src/__tests__/ReactCompositeComponent-test.js index 7006f51b77f52..9c30eaecdf7c0 100644 --- a/packages/react-dom/src/__tests__/ReactCompositeComponent-test.js +++ b/packages/react-dom/src/__tests__/ReactCompositeComponent-test.js @@ -6,9 +6,10 @@ * * @emails react-core */ - 'use strict'; +import hasOwnProperty from 'shared/hasOwnProperty' + let ChildUpdates; let MorphingComponent; let React; @@ -19,7 +20,6 @@ let ReactTestUtils; let PropTypes; describe('ReactCompositeComponent', () => { - const hasOwnProperty = Object.prototype.hasOwnProperty; /** * Performs equality by iterating through keys on an object and returning false diff --git a/packages/react-dom/src/client/ReactDOMComponent.js b/packages/react-dom/src/client/ReactDOMComponent.js index 71da034466c8a..fd147559562dc 100644 --- a/packages/react-dom/src/client/ReactDOMComponent.js +++ b/packages/react-dom/src/client/ReactDOMComponent.js @@ -13,6 +13,7 @@ import { } from '../events/EventRegistry'; import {canUseDOM} from 'shared/ExecutionEnvironment'; +import hasOwnProperty from 'shared/hasOwnProperty'; import { getValueForAttribute, @@ -443,7 +444,7 @@ export function createElement( !isCustomComponentTag && Object.prototype.toString.call(domElement) === '[object HTMLUnknownElement]' && - !Object.prototype.hasOwnProperty.call(warnedUnknownTags, type) + !hasOwnProperty.call(warnedUnknownTags, type) ) { warnedUnknownTags[type] = true; console.error( diff --git a/packages/react-dom/src/server/ReactPartialRenderer.js b/packages/react-dom/src/server/ReactPartialRenderer.js index de4f3b78599a2..9d6b2d885fb72 100644 --- a/packages/react-dom/src/server/ReactPartialRenderer.js +++ b/packages/react-dom/src/server/ReactPartialRenderer.js @@ -77,7 +77,7 @@ import warnValidStyle from '../shared/warnValidStyle'; import {validateProperties as validateARIAProperties} from '../shared/ReactDOMInvalidARIAHook'; import {validateProperties as validateInputProperties} from '../shared/ReactDOMNullInputValuePropHook'; import {validateProperties as validateUnknownProperties} from '../shared/ReactDOMUnknownPropertyHook'; -import hasOwnProperty from '../../../shared/hasOwnProperty'; +import hasOwnProperty from 'shared/hasOwnProperty'; export type ServerOptions = { identifierPrefix?: string, diff --git a/packages/react-dom/src/shared/ReactDOMInvalidARIAHook.js b/packages/react-dom/src/shared/ReactDOMInvalidARIAHook.js index 11cbe02c72087..f665b275ba5b4 100644 --- a/packages/react-dom/src/shared/ReactDOMInvalidARIAHook.js +++ b/packages/react-dom/src/shared/ReactDOMInvalidARIAHook.js @@ -8,7 +8,7 @@ import {ATTRIBUTE_NAME_CHAR} from './DOMProperty'; import isCustomComponent from './isCustomComponent'; import validAriaProperties from './validAriaProperties'; -import hasOwnProperty from '../../../shared/hasOwnProperty'; +import hasOwnProperty from 'shared/hasOwnProperty'; const warnedProperties = {}; const rARIA = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$'); diff --git a/packages/react-dom/src/shared/ReactDOMUnknownPropertyHook.js b/packages/react-dom/src/shared/ReactDOMUnknownPropertyHook.js index 8b928ff41de02..5070b844eb816 100644 --- a/packages/react-dom/src/shared/ReactDOMUnknownPropertyHook.js +++ b/packages/react-dom/src/shared/ReactDOMUnknownPropertyHook.js @@ -14,7 +14,7 @@ import { } from './DOMProperty'; import isCustomComponent from './isCustomComponent'; import possibleStandardNames from './possibleStandardNames'; -import hasOwnProperty from '../../../shared/hasOwnProperty'; +import hasOwnProperty from 'shared/hasOwnProperty'; let validateProperty = () => {}; diff --git a/packages/react-server-dom-relay/src/ReactFlightDOMRelayServerHostConfig.js b/packages/react-server-dom-relay/src/ReactFlightDOMRelayServerHostConfig.js index 7f466e590834e..31f4def4e1268 100644 --- a/packages/react-server-dom-relay/src/ReactFlightDOMRelayServerHostConfig.js +++ b/packages/react-server-dom-relay/src/ReactFlightDOMRelayServerHostConfig.js @@ -13,7 +13,7 @@ import type {Request, ReactModel} from 'react-server/src/ReactFlightServer'; import JSResourceReference from 'JSResourceReference'; -import hasOwnProperty from '../../shared/hasOwnProperty'; +import hasOwnProperty from 'shared/hasOwnProperty'; export type ModuleReference = JSResourceReference; diff --git a/packages/react-server-native-relay/src/ReactFlightNativeRelayServerHostConfig.js b/packages/react-server-native-relay/src/ReactFlightNativeRelayServerHostConfig.js index febea03d45b52..34bd73b5c10a2 100644 --- a/packages/react-server-native-relay/src/ReactFlightNativeRelayServerHostConfig.js +++ b/packages/react-server-native-relay/src/ReactFlightNativeRelayServerHostConfig.js @@ -10,7 +10,7 @@ import type {RowEncoding, JSONValue} from './ReactFlightNativeRelayProtocol'; import type {Request, ReactModel} from 'react-server/src/ReactFlightServer'; -import hasOwnProperty from '../../shared/hasOwnProperty'; +import hasOwnProperty from 'shared/hasOwnProperty'; import JSResourceReferenceImpl from 'JSResourceReferenceImpl'; export type ModuleReference = JSResourceReferenceImpl; diff --git a/packages/shared/checkPropTypes.js b/packages/shared/checkPropTypes.js index eb067fb4c0878..1558a407c3888 100644 --- a/packages/shared/checkPropTypes.js +++ b/packages/shared/checkPropTypes.js @@ -12,6 +12,7 @@ const loggedTypeFailures = {}; import {describeUnknownElementTypeFrameInDEV} from 'shared/ReactComponentStackFrame'; import ReactSharedInternals from 'shared/ReactSharedInternals'; +import hasOwnProperty from 'shared/hasOwnProperty'; const ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; @@ -40,7 +41,7 @@ export default function checkPropTypes( ): void { if (__DEV__) { // $FlowFixMe This is okay but Flow doesn't know it. - const has = Function.call.bind(Object.prototype.hasOwnProperty); + const has = Function.call.bind(hasOwnProperty); for (const typeSpecName in typeSpecs) { if (has(typeSpecs, typeSpecName)) { let error;