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

transformer: 2n ** 32n gets transformed into runtime error Math.pow(2n, 32n) #5822

Closed
Boshen opened this issue Sep 17, 2024 · 3 comments · Fixed by #7184
Closed

transformer: 2n ** 32n gets transformed into runtime error Math.pow(2n, 32n) #5822

Boshen opened this issue Sep 17, 2024 · 3 comments · Fixed by #7184
Assignees
Labels
C-bug Category - Bug

Comments

@Boshen
Copy link
Member

Boshen commented Sep 17, 2024

I think we need to bail in this case :-/

tsc and esbuild throws "BigInt literals are not available when targeting lower than ES2020."

@Boshen Boshen added the C-bug Category - Bug label Sep 17, 2024
@overlookmotel
Copy link
Collaborator

overlookmotel commented Sep 17, 2024

Background on why it's not feasible to support BigInt with a polyfill: evanw/esbuild#732

It looks like we should bail on any BigInt literal, not just when used with **.

Side note: Math.pow with any BigInt values is a runtime error, they don't have to be big numbers. e.g. Math.pow(1n, 1n) is a runtime error.

@Boshen Boshen self-assigned this Sep 19, 2024
@Boshen
Copy link
Member Author

Boshen commented Sep 23, 2024

@Dunqing How do we determine whether https://babel.dev/docs/babel-plugin-syntax-bigint is enabled or not in our transformer?

Boshen added a commit that referenced this issue Sep 24, 2024
part of #5822

They will produce runtime errors.
@Boshen Boshen assigned Dunqing and unassigned Boshen Sep 24, 2024
@Boshen
Copy link
Member Author

Boshen commented Sep 24, 2024

@Dunqing need to figure out whether bigint is targeted or not.

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

Successfully merging a pull request may close this issue.

3 participants