developit / developit/microbundle

[Bug] Wrong function scope with rest parameters after transpiled

オープン
#1,037 コメント 9 件 リアクション 0 件 担当者 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 を短くまとめたダイジェスト。