Skip to content
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

es6转换问题 #139

Open
yzend opened this issue Dec 21, 2023 · 1 comment
Open

es6转换问题 #139

yzend opened this issue Dec 21, 2023 · 1 comment

Comments

@yzend
Copy link

yzend commented Dec 21, 2023

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):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

@yzend
Copy link
Author

yzend commented Dec 21, 2023

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant