You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The syntax has been implemented in Babylon, see babel/babylon#569 (comment) . What remains is a plugin to implement the transform.
All arithmetic operations and comparisons should be replaced by calls to functions which provide the appropriate behavior depending whether arguments are BigInts or Numbers.
The transform is slow, so it will really be more of a toy rather than something that should be used in production. For this reason, I'd argue it should be left out of Babel presets.
Polyfill needed--ideally, this would be a thin wrapper around another BigNum library from npm. There are just a few methods to support. Some functions will have to be a bit different to get close to the right behavior, for example, valueOf() should throw a TypeError, so that implicitly casting to Number throws a TypeError, even if it would really return the BigInt. Additionally, the polyfill needs BigInt64Array and DataView operations.
@littledan apologies for the delay on this, haven't had as much time to work on it as I expected. i'm planning on digging in this weekend and hopefully getting through a lot of it, and i just put up a WIP PR with the transform for adding BigInts, with a few questions babel/babel#6015
Activity
wdhorton commentedon Jun 29, 2017
Now that the syntax has been implemented, I can go ahead and work on the transform too
littledan commentedon Jul 12, 2017
How's this implementation coming along? Anything I could help with?
BTW there are some tests to start with in test262 here from my colleague @cxielarko at Igalia, but there's a lot of room for additional tests.
[-]Implement the BigInt proposal[/-][+]BigInt (Stage 2)[/+]wdhorton commentedon Jul 26, 2017
@littledan apologies for the delay on this, haven't had as much time to work on it as I expected. i'm planning on digging in this weekend and hopefully getting through a lot of it, and i just put up a WIP PR with the transform for adding BigInts, with a few questions babel/babel#6015
[-]BigInt (Stage 2)[/-][+]BigInt (Stage 3)[/+]towc commentedon May 4, 2018
any developments on this? Somewhere you might want help?
graup commentedon Oct 24, 2018
There's a PR with some progress in babel/babel#6015. I'd also love to see this working, as Chrome has built-in support for bigints now (https://developers.google.com/web/updates/2018/05/bigint), so it would make sense to start writing code with the new syntax.
littledan commentedon Oct 24, 2018
Seems like this would be a good project for someone to pick up.
Bnaya commentedon Nov 9, 2018
FYI: typescript have merged their BigInt support!
microsoft/TypeScript#25886