BigInt polyfill?
xtuc opened this issue ยท 4 comments
The BigInt proposal is currently in Stage 3, see https://github.com/tc39/proposal-bigint.
We could use it in Babel babel/babel#6015.
The problem here - BigInt
is mainly about internal abstract JS operations, not built-it. Full BigInt
built-it API is:
class BigInt {
constructor(value): bigint;
static asUintN(bits, bigint): bigint;
static asIntN(bits, bigint) : bigint;
toString(radix): string;
toLocaleString(radix): string;
valueOf(): bigint;
@@toStringTag: 'BigInt';
}
Also required extensions of some existent features.
So, Babel
can interact with BigInt
built-in only through BigInt
constructor and toString
method -> Babel
should implement all abstract operations in helpers instead of calling BigInt
methods like in PR, otherwise, you will not be able to interact with native BigInt
. Wrapping almost all operators makes this transform unusable for real projects. So I'm confused.
After some days I'll merge v3
branch to master branch, after that feel free add a PR with BigInt
polyfill - let's explore what we can do.
(Just a note: JSBI
is not a polyfill, it's like to say that regenerator
is a polyfill for generators and with the current core-js
approach it can't be integrated to core-js
.)
I think that it's better to close this issue, I'll add a link to it to the README. If someone has any thoughts about it - write it here.