We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
for ... of
Map
TypeScript Version: 2.1.6
Code
let entries: Map<string, string[]> = new Map<string, string[]>(); entries.set('a', ['foo']) for (let entry of entries.values()) { // do something with the entry }
Expected behavior: Since Typescript is advertised as a superset of ES6 than expected is that it should support es6 features. Therefor for ... of should work properly with IterableIterator as described here : https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Map
IterableIterator
Actual behavior: Compilation fails
TS2495: Type 'IterableIterator<string[]>' is not an array type or a string type.
The text was updated successfully, but these errors were encountered:
The main complexity is the emit required for iterator support : http://babeljs.io/repl/#?babili=false&evaluate=true&lineWrap=false&presets=latest%2Creact%2Cstage-2&targets=&browsers=&builtIns=false&code=let%20entries%3A%20Map%3Cstring%2C%20string%5B%5D%3E%20%3D%20new%20Map()%3B%0Aentries.set('a'%2C%20%5B'foo'%5D)%0Afor%20(let%20entry%20of%20entries.values())%20%7B%0A%2F%2F%20do%20something%20with%20the%20entry%0A%7D&experimental=false&loose=false&spec=false&playground=true
emit
TypeScript emitter doesn't have this support yet 🌹
Sorry, something went wrong.
This should be addressed by #12346 under --downlevelIteration. Make sure es2015 or es2015.iterable is part of your --lib arguments.
--downlevelIteration
es2015
es2015.iterable
--lib
No branches or pull requests
TypeScript Version: 2.1.6
Code
Expected behavior:
Since Typescript is advertised as a superset of ES6 than expected is that it should support es6 features. Therefor
for ... of
should work properly withIterableIterator
as described here : https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/MapActual behavior:
Compilation fails
The text was updated successfully, but these errors were encountered: