verekia / js-stack-from-scratch

🛠️⚡ Step-by-step tutorial to build a modern JavaScript stack.
MIT License
20.05k stars 1.99k forks source link

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

Open durgaprasadksv opened 6 years ago

durgaprasadksv commented 6 years ago

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.

ghost commented 6 years ago

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