Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[Transpiling] Rest parameters with async bug

Open
#1,001 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
38/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript
Domain
build-system

Research direction

Start by reproducing the minimal JavaScript case and comparing the generated output with the reported expectation. Trace the async and rest-parameter transpilation, especially how inlining affects the scope used for arguments; done means the generated _arguments2 reference is captured from the outer function rather than the nested callback.

Written by the indexing model from the issue text.

Description

Minimal test case:

export const brokenArgsRest = async (...props) => {
  await someAsyncFunction(async () => {  
      console.log(props)
  })
}

export const someAsyncFunction = async callback => {
  await callback()
}

generates

var brokenArgsRest = function brokenArgsRest() {
  return Promise.resolve(someAsyncFunction(function () {
    try {
      var _arguments2 = arguments;
      console.log([].slice.call(_arguments2));
      return Promise.resolve();
    } catch (e) {
      return Promise.reject(e);
    }
  })).then(function () {});
};
var someAsyncFunction = function someAsyncFunction(callback) {
  try {
    return Promise.resolve(callback()).then(function () {});
  } catch (e) {
    return Promise.reject(e);
  }
};

var _arguments2 = arguments; should be one more level up

Context:
We hit this bug on fcl-js lib : https://github.com/onflow/flow-js-testing/issues/182

PS: my js knowledge is limited, but seems related to inlining somehow.

Dominant language
JavaScript
Stars
8.1k
Forks
358
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from developit/microbundle

All issues in developit/microbundle

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.