I've come across a use case with Flow, and when I use document.documentElement I need to first type refine it because it has the possibility of being null as defined in their built in definitions.
https://github.com/facebook/flow/blob/8391250177e37a047a33ae728fdbd1138632294a/lib/dom.js#L824
const { documentElement } = document;
if (documentElement instanceof HTMLElement) {
// continue doing stuff
}
Doing a simple google does not yield any results for why this is the case. So my question is when can this value be null or is it a mistake from the lib defs?