From 2225b980aa14248dd647a55505e27093e4e48623 Mon Sep 17 00:00:00 2001 From: Flarnie Marchan Date: Wed, 19 Jul 2017 16:02:02 -0700 Subject: [PATCH] Force an 'any' type for the `hostInstance.parentNode` in warning check **what is the change?:** This is awful. :( I'm not sure how else to let Flow know that we expect that this might be a sort of `DOMContainer` type and not just a normal `Node` type. To at least make the type information clear we added a comment. **why make this change?:** To get `flow` passing. Looks like we have `any` types sprinkled throughout this file. phooey. :( **test plan:** `yarn flow` **issue:** https://github.com/facebook/react/issues/8854 --- src/renderers/dom/fiber/ReactDOMFiberEntry.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/renderers/dom/fiber/ReactDOMFiberEntry.js b/src/renderers/dom/fiber/ReactDOMFiberEntry.js index ac95d15a3c33d..e01fff18f0f8a 100644 --- a/src/renderers/dom/fiber/ReactDOMFiberEntry.js +++ b/src/renderers/dom/fiber/ReactDOMFiberEntry.js @@ -75,11 +75,9 @@ findDOMNode._injectFiber(function(fiber: Fiber) { type DOMContainer = | (Element & { _reactRootContainer: ?Object, - __reactInternalIsPortalContainer: ?boolean, }) | (Document & { _reactRootContainer: ?Object, - __reactInternalIsPortalContainer: ?boolean, }); type Container = Element | Document; @@ -541,10 +539,11 @@ function renderSubtreeIntoContainer( const hostInstance = DOMRenderer.findHostInstance( container._reactRootContainer.current, ); + const hostInstanceParentNode: any = + hostInstance && hostInstance.parentNode; const hostInstanceParentIsPortal = - hostInstance && - hostInstance.parentNode && - hostInstance.parentNode.__reactInternalIsPortalContainer; + hostInstanceParentNode && + hostInstanceParentNode.__reactInternalIsPortalContainer; if (hostInstance && !hostInstanceParentIsPortal) { warning( hostInstance.parentNode === container,