-
Notifications
You must be signed in to change notification settings - Fork 12.5k
New issue
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
Symbol.interator for array of numbers? #11102
Comments
That seems to be a really odd configuration of Playground that is causing it with the release of TypeScript 2.0. It seems like the Playground is sort of stuck between ES5 and ES6. The emit is ES5, but the syntax checking is ES6 but without the proper libraries loaded. Running locally, both targeting ES5 and ES6 that works without issue. |
That's right @kitsonk, but only occurs in the playground. Also async and generator statements are "compiled" with no problems, but the result code is not compatible with ES5 and below. I've tested it with VS Code too but I do not get problems. |
I get this error when running the code above targeting ES5 output. i.e. not limited to playground for me: |
@sccolbert did that ever work? I think what you are proposing is covered by #5296 which is still just a proposal. |
@kitsonk I could have sworn it used to be translated to a |
For example, this compiles fine on TS 1.8:
But as you mentioned, the original code I posted does not. Which is doubly strange :) |
And that code seems fine on playground too: http://www.typescriptlang.org/play/#src=var%20values%3A%20number%5B%5D%20%3D%20%5B1%2C%202%2C%203%2C%204%2C%205%5D%3B%0D%0Avar%20data%3A%20number%5B%5D%20%3D%20%5B%5D%3B%0D%0A%0D%0Adata.push(...values)%3B |
this is an issue with the playground. we recently updated to the latest version of monco-editor and that seems to set the target to ES6 all the time. i will see if i can get a fix for this soon. sorry for the confusion. Iterators are only supported when your targeting ES6. so |
Sounds like my example is a red herring (sorry). |
Should be fixed now. sorry about the confusion. |
TypeScript Version: Playground.
Hi, in the playground version I found this:
Code
Expected behavior:
No error.
Actual behavior:
An error.
In normal JS this is not an error:
The text was updated successfully, but these errors were encountered: