Types You Don't Control 12 exercises

Update DOM Typing to Include Iterable

Here we're selecting all the div elements present on a page with document.querySelectorAll. This results in a NodeList comprising HTMLDivElement:

const elements = document.querySelectorAll("div");

Next, we attempt to loop over each element within elements:

for (const

Loading exercise


00:00 In this exercise, we're grabbing some elements from the DOM by saying document.getQuerySelectorAll. We're grabbing a bunch of divs here. And what we end up with is a node list of HTML div element. And then we're mapping over const element of elements here. And notice here that it's saying

00:19 type node list of HTML div element must have a symbol.iterator method that returns an iterator. What on earth? Turns out we've actually misconfigured our TS config a little bit. Your job is to work out what's happening here and how we can change lib in order to make this work. Good luck.