When developing in the babylonjs repo, there is a custom eslint rule babylonjs/no-downlevel-iteration disallows using for-of against Maps, and in the umd packages, for-of loop is compiled to indexed for loops, but it’s kept as-is in esm packages.
So is it safe for downstream users of esm packages to enable similar transform for esm packages, like assumeArray: true of @babel/plugin-transform-for-of, as a performance optimization, or it “just work” now but might change in future versions?
Yes, because we target ES5 for our UMD packages. so the short answer is - no, it would be better not to use this until we move to a newer ES version for our UMD packages (which might come earlier than expected, mainly due to TC39’s decorations).
I saw both yes and no, can I interpret this as:
- Safe for curr released versions
- Might change in furure versions
Sorry! I answered yes to a question with “or” ![]()
It is safe for you to use it, of course. If you don’t target any es5 users (which you shouldn’t, IMO) - use it for sure. wonderful syntax. Do not use it when implementing anything for babylon.js core, as we are still using es5 in our UMD packages.
I hope this is clearer, and sorry for the confusion before.