Skip to content

Commit

Permalink
Force an 'any' type for the hostInstance.parentNode in warning check
Browse files Browse the repository at this point in the history
**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:**
facebook#8854
  • Loading branch information
flarnie committed Jul 20, 2017
1 parent 7f9648b commit 2225b98
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/renderers/dom/fiber/ReactDOMFiberEntry.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 2225b98

Please sign in to comment.