I m试图在保持类型的同时,用手法书写字.。 例如,
function* naturals(max=10) { for (let i=0; i<max; i++) yield i }
const x = [1, 2, 3]
const y = ["a", "b", "c"]
const zipped = zip(naturals(), x, y)
console.log([...zipped]) // => [[0, 1, "a"], [1, 2, "b"], [2, 3, "c"]]
function* zip<?>(...iterables:?[]) {
const iterators = iterables.map(iter => iter[Symbol.iterator]())
...
}
是否有有助于保护我类型的签字?