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

** operator #8

Closed
achingbrain opened this issue Mar 24, 2021 · 1 comment
Closed

** operator #8

achingbrain opened this issue Mar 24, 2021 · 1 comment

Comments

@achingbrain
Copy link
Contributor

This line gets transpiled to Math.pow by the default settings of create-react-app which means you end up doing Math.pow(BigInt(2), BigInt(64)) which fails with Uncaught TypeError: Cannot convert a BigInt value to a number

achingbrain referenced this issue in achingbrain/cborg Mar 25, 2021
We can't use the `**` operator as right now it gets transpiled to `Math.pow`
which only takes Numbers.

Similarly, trying to avoid referencing node globals to get a `Buffer` instance
causes similar problems now that bundlers don't tend to come with node polyfills
any more.

Swaps the use of `**` for the BigInt literal result of the calculation and uses
the `Buffer` module to ensure compatibility.

Fixes #7
Fixes #8

Please publish with a `main` field to also fix #9.
@achingbrain
Copy link
Contributor Author

Fixed in #11

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

Successfully merging a pull request may close this issue.

1 participant