verekia/js-stack-from-scratch

Flow error in chapter 04. Flow error: (This type is incompatible with the expected param type of Element)

durgaprasadksv opened this issue · 1 comments

Type of issue: Bug

Chapter: 04

If it's a bug: Yes

Flow error: (This type is incompatible with the expected param type of Element)
ReactDOM.render(, document.querySelector(APP_CONTAINER_SELECTOR));

But if I add the following code.
const rootEl = document.querySelector(APP_CONTAINER_SELECTOR);
if (!(rootEl instanceof Element)) {
throw new Error('invalid type');
}
ReactDOM.render(, rootEl);

the Flow errors are gone.

Thanks for pointing this out. It was driving me batty when trying to push my code.