Iterable 接口

如果我们想采用上面列出的可迭代类型,Iterable 是我们可以使用的类型。这是一个例子:

Iterable is a type we can use if we want to take in types listed above which are iterable. Here is an example:

function toArray<X>(xs: Iterable<X>): X[] {
  return [...xs]
}