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

Feature request: Improved error async arrow functions are unsupported #1395

Open
leotm opened this issue May 7, 2024 · 5 comments
Open

Feature request: Improved error async arrow functions are unsupported #1395

leotm opened this issue May 7, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@leotm
Copy link

leotm commented May 7, 2024

Problem

async arrow functions (ignored by Babel) trigger Hermes error

AF->getSourceRange(), Twine("async functions are unsupported"));

causing ./gradlew :app:installRelease to fail
after Metro finishes bundling

Solution

it would be great if Hermes would output instead

async arrow functions are unsupported

Additional Context

nb: i think Static Hermes will be supporting arrow functions too

@leotm leotm added the enhancement New feature or request label May 7, 2024
@tmikov
Copy link
Contributor

tmikov commented May 7, 2024

That is a good point. So, basically we need to make the error message more specific. Can you please submit a PR for this?

@kleydon
Copy link

kleydon commented Aug 11, 2024

Has anyone figured out how to configure support for async arrow functions using plug-ins, in the meantime? Would really love to know how to do this.

@ChALkeR
Copy link

ChALkeR commented Sep 11, 2024

@fbmal7
Copy link
Contributor

fbmal7 commented Sep 11, 2024

FWIW, async arrows are implemented in SH

@kleydon
Copy link

kleydon commented Sep 12, 2024

@ChALkeR , @fbmal7 - thanks!

Prithpal-Sooriya added a commit to MetaMask/core that referenced this issue Sep 20, 2024
## Explanation

Our package has exported async arrow functions, which cannot be compiled
during the `detox build android` step on mobile.

<details><summary>See error logs</summary>

![Screenshot 2024-09-20 at 21 16
55](https://github.com/user-attachments/assets/08c49d3e-b448-40cf-ad23-715dbd10d185)
</details> 

It is most likely related to this hermes error:
facebook/hermes#1395

This removes the exported async arrow functions in the bundle for normal
async functions.

Long term we should either:
- Add ESLint rules to prevent other devs or teams being burnt by this
- Or have a transpilation step to avoid async arrow functions.

## References

<!--
Are there any issues that this pull request is tied to?
Are there other links that reviewers should consult to understand these
changes better?
Are there client or consumer pull requests to adopt any breaking
changes?

For example:

* Fixes #12345
* Related to #67890
-->

https://consensyssoftware.atlassian.net/browse/NOTIFY-1144

## Changelog

### `@metamask/profile-sync-controller`

- **CHANGED**: updated exported async arrow functions to normal async
functions.

## Checklist

- [x] I've updated the test suite for new or updated code as appropriate
- [x] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [x] I've highlighted breaking changes using the "BREAKING" category
above as appropriate
- [x] I've prepared draft pull requests for clients and consumer
packages to resolve any breaking changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants