Type 'IterableIterator<number>' is not an array type or a string type
Solution 1:
Apparently it is being strict and doesn't want to create an array using spread from an iterator (which is not an array). However it's possible to create an array from an iterator using the Array.from
function:
range(size: number, startAt = 0) {
return Array.from(Array(size).keys()).map((i) => i + startAt);
}
Array.from
accepts Iterable
.