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
TypeError when using the ** operator with BigInt #6706
Comments
This bug is interesting! I noticed that the error only seems to occur in the preview, and not the TS runtime used by, for example, the editor / linter. Does this match with your experience? |
Absolutely, I also don’t get any error in the editor itself. |
This issue took some digging to figure out. It looks like you might be seeing this issue because of the way we use Create React App for the preview portion of the page. I was able to fix the preview by modifying the default
After this change, Babel in the preview no longer tries to coerce the BigInts into numbers prior to calling the exponentiation. Hope this helps, and sorry you ran into this! |
Cool thanks! |
🐛 bug report
Preflight Checklist
adheres to.
to file, without success.
Description of the problem
I can’t use the
**
operator onBigInt
values without triggering an error. It seems CodeSandbox attempts to convertBigInt
s into Number when**
is used, even though this is a validBigInt
operator. Perhaps**
are being converted intoMath.pow()
calls internally, which only supports numbers.Note: I don’t have this problem with Vite or Parcel 1.x when used locally. I also tried to update the Parcel version in CodeSandbox, but I get the same error.
To Reproduce
From the CodeSandbox TypeScript template:
target
toes2020
in the tsconfig.json (in order to support BigInt).10n ** 2n
anywhere.Link to sandbox: link (optional)
https://codesandbox.io/s/codesandbox-issue-bigint-power-6vi5lb?file=/src/index.ts
Your Environment
The text was updated successfully, but these errors were encountered: