From 92e196c06124827da091b3c9feca2275914988a7 Mon Sep 17 00:00:00 2001 From: Mofei Zhang Date: Fri, 9 Sep 2022 17:53:30 -0400 Subject: [PATCH] [nit] Remove redundant 20517typeof check --- packages/react-reconciler/src/ReactFiberHooks.new.js | 5 ++--- packages/react-reconciler/src/ReactFiberHooks.old.js | 5 ++--- packages/react-server/src/ReactFizzHooks.js | 5 ++--- packages/react-server/src/ReactFlightHooks.js | 5 +---- 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/packages/react-reconciler/src/ReactFiberHooks.new.js b/packages/react-reconciler/src/ReactFiberHooks.new.js index e195bd62a0200..6ca089ff2d0a8 100644 --- a/packages/react-reconciler/src/ReactFiberHooks.new.js +++ b/packages/react-reconciler/src/ReactFiberHooks.new.js @@ -774,9 +774,8 @@ function use(usable: Usable): T { } } } else if ( - usable.$$typeof != null && - (usable.$$typeof === REACT_CONTEXT_TYPE || - usable.$$typeof === REACT_SERVER_CONTEXT_TYPE) + usable.$$typeof === REACT_CONTEXT_TYPE || + usable.$$typeof === REACT_SERVER_CONTEXT_TYPE ) { const context: ReactContext = (usable: any); return readContext(context); diff --git a/packages/react-reconciler/src/ReactFiberHooks.old.js b/packages/react-reconciler/src/ReactFiberHooks.old.js index c0f0660efe212..133dc8d5dd6eb 100644 --- a/packages/react-reconciler/src/ReactFiberHooks.old.js +++ b/packages/react-reconciler/src/ReactFiberHooks.old.js @@ -774,9 +774,8 @@ function use(usable: Usable): T { } } } else if ( - usable.$$typeof != null && - (usable.$$typeof === REACT_CONTEXT_TYPE || - usable.$$typeof === REACT_SERVER_CONTEXT_TYPE) + usable.$$typeof === REACT_CONTEXT_TYPE || + usable.$$typeof === REACT_SERVER_CONTEXT_TYPE ) { const context: ReactContext = (usable: any); return readContext(context); diff --git a/packages/react-server/src/ReactFizzHooks.js b/packages/react-server/src/ReactFizzHooks.js index a5a485db70189..b330605260afd 100644 --- a/packages/react-server/src/ReactFizzHooks.js +++ b/packages/react-server/src/ReactFizzHooks.js @@ -621,9 +621,8 @@ function use(usable: Usable): T { } } } else if ( - usable.$$typeof != null && - (usable.$$typeof === REACT_CONTEXT_TYPE || - usable.$$typeof === REACT_SERVER_CONTEXT_TYPE) + usable.$$typeof === REACT_CONTEXT_TYPE || + usable.$$typeof === REACT_SERVER_CONTEXT_TYPE ) { const context: ReactContext = (usable: any); return readContext(context); diff --git a/packages/react-server/src/ReactFlightHooks.js b/packages/react-server/src/ReactFlightHooks.js index 79dfee587116c..dfb234b15ad27 100644 --- a/packages/react-server/src/ReactFlightHooks.js +++ b/packages/react-server/src/ReactFlightHooks.js @@ -200,10 +200,7 @@ function use(usable: Usable): T { } } } - } else if ( - usable.$$typeof != null && - usable.$$typeof === REACT_SERVER_CONTEXT_TYPE - ) { + } else if (usable.$$typeof === REACT_SERVER_CONTEXT_TYPE) { const context: ReactServerContext = (usable: any); return readContext(context); }