developit / developit/microbundle

[Bug] Wrong function scope with rest parameters after transpiled

未關閉
#1,037 9 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
JavaScript
星號
8.1k
分支
358
PR 合併指標
30 天內沒有已合併 PR

描述

### description
async function with rest parameters seems got wrong function scope after transpiled

### version
microbundle@^0.15.1

### reproduce demo

```
// tsconfig.json

{
"compilerOptions": {
"esModuleInterop": true,
"target": "ES6",
"strict": true,
"moduleResolution": "node",
"experimentalDecorators": true,
"baseUrl": ".",
"allowJs": true
},
"include": ["*.ts"]
}

```

```
// test.ts

export const fn = async (...args: unknown[]) => {
await 1;
[].forEach(() => console.log(...args))
}
```

```
// test.js (generated by `microbundle -i test.ts -o test.js`)

exports.fn = function () {
return Promise.resolve(1).then(function () {
var n = arguments; // <- wrong function scope!!!
[].forEach(function () {
var o;
return (o = console).log.apply(o, [].slice.call(n));
});
});
};
//# sourceMappingURL=test.js.map
```

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。