example:
function foo(iterable) {
for (let i of iterable) {}
}
What type could iterable be here asides from any? other examples include Array.from and most of the other iterable data structure constructors.
Iterable is an ES6 feature, so setting your tsc target to "es6" lets you take in an Iterable as a parameter, e.g.
function foo<T>(iterable: Iterable<T>) {
for (let i of iterable) {}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With