diff --git a/compiler/packages/babel-plugin-react-compiler/src/Utils/ComponentDeclaration.ts b/compiler/packages/babel-plugin-react-compiler/src/Utils/ComponentDeclaration.ts index 80175064f998..e78ffc570cb8 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/Utils/ComponentDeclaration.ts +++ b/compiler/packages/babel-plugin-react-compiler/src/Utils/ComponentDeclaration.ts @@ -6,6 +6,7 @@ */ import * as t from '@babel/types'; +import {hasOwnProperty} from './utils'; export type ComponentDeclaration = t.FunctionDeclaration & { __componentDeclaration: boolean; @@ -14,7 +15,7 @@ export type ComponentDeclaration = t.FunctionDeclaration & { export function isComponentDeclaration( node: t.FunctionDeclaration, ): node is ComponentDeclaration { - return Object.prototype.hasOwnProperty.call(node, '__componentDeclaration'); + return hasOwnProperty(node, '__componentDeclaration'); } export function parseComponentDeclaration( diff --git a/compiler/packages/babel-plugin-react-compiler/src/Utils/HookDeclaration.ts b/compiler/packages/babel-plugin-react-compiler/src/Utils/HookDeclaration.ts index 0e82d26eeeb3..9eb28a39d14b 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/Utils/HookDeclaration.ts +++ b/compiler/packages/babel-plugin-react-compiler/src/Utils/HookDeclaration.ts @@ -6,6 +6,7 @@ */ import * as t from '@babel/types'; +import {hasOwnProperty} from './utils'; export type HookDeclaration = t.FunctionDeclaration & { __hookDeclaration: boolean; @@ -14,7 +15,7 @@ export type HookDeclaration = t.FunctionDeclaration & { export function isHookDeclaration( node: t.FunctionDeclaration, ): node is HookDeclaration { - return Object.prototype.hasOwnProperty.call(node, '__hookDeclaration'); + return hasOwnProperty(node, '__hookDeclaration'); } export function parseHookDeclaration( diff --git a/packages/react-devtools-shared/src/devtools/views/utils.js b/packages/react-devtools-shared/src/devtools/views/utils.js index a2d254bc27d8..1b9e0fb7b0fa 100644 --- a/packages/react-devtools-shared/src/devtools/views/utils.js +++ b/packages/react-devtools-shared/src/devtools/views/utils.js @@ -11,12 +11,10 @@ import escapeStringRegExp from 'escape-string-regexp'; import {meta} from '../../hydration'; import {formatDataForPreview} from '../../utils'; import isArray from 'react-devtools-shared/src/isArray'; +import hasOwnProperty from 'shared/hasOwnProperty'; import type {HooksTree} from 'react-debug-tools/src/ReactDebugHooks'; -// $FlowFixMe[method-unbinding] -const hasOwnProperty = Object.prototype.hasOwnProperty; - export function alphaSortEntries( entryA: [string, mixed], entryB: [string, mixed],