eleme / morjs

基于小程序 DSL(微信、支付宝)的,可扩展的多端研发框架,支持一键将微信或支付宝小程序转换为微信、支付宝、百度、字节、QQ、快手、淘宝、钉钉等小程序 或 Web 应用。
https://mor.ele.me/
MIT License
1.74k stars 113 forks source link

es6转换问题 #139

Open yzend opened 11 months ago

yzend commented 11 months ago

Describe the bug 源项目是 微信,再编译后转 es5 Set的解构有问题 以及 array的entries() 迭代器转换问题

To Reproduce Steps to reproduce the behavior: let a = [1,2,3] a = [...new Set(a)] console.log(a, 'a') // [] a为空数组

for (const [index, ele] of a.entries()) { console.log(index, ele) // 不触发 console }

Expected behavior 预期期望出现 [1,2,3]

迭代器出现 0,1 1,2 2,3 myapp.zip

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

yzend commented 11 months ago

https://stackoverflow.com/questions/33464504/using-spread-syntax-and-new-set-with-typescript

在typescript 进行编译的时候 需要使用新的 迭代器协议 function tsTransform() { const tsCompilerOptions = { downlevelIteration: true } } 是否考虑增加 默认降级迭代器协议