telescope
telescope copied to clipboard
Getting rid of the Long dependency
Getting rid of the Long dependency. It’s a fragile implementation and causes various issues in the module system. We can use BigInt
for the objects these days and accept bigint | number | string
in fromPartial
.
- [ ] investigate compat https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt
- [ ] https://github.com/cosmos/cosmjs/issues/1144
CosmJS depends on BigInt already through the @noble/hashes dependency. We'll not go backwards from here. The only environment that is struggeling with BigInt is React Native, but there seem to be ways to solve it. But this needs to be solved by the React Native community.
Info about BigInt
issues with babel for reference: https://stackoverflow.com/questions/57902010/how-to-use-bigint-exponentiation-with-babel
when we get rid of the Long
dependency, let's also make to
- [ ] remove the lines added from this commit
Could we start by using BigInt/Long as a configurable option? Then we can try it out and always go back if we run into trouble. Also different Telescope users might have different demands.
Could we start by using BigInt/Long as a configurable option? Then we can try it out and always go back if we run into trouble. Also different Telescope users might have different demands.
absolutely. BigInt
is the plan here :)
my general approach has been, let's keep the default output the same, and add everything as an option. Then we can use the options, once they're stable, we can change the defaults.
We now use telescope for the code-generation in cosmjs-types 0.6 and 0.7, which will be used automatically with the next CosmJS 0.30.
Personally I think getting looking into this feature would be a great step forward to reduce the dependency hell around long and @types/long.
yes! I'm guessing we should look at:
- what
BigInt
does to the encoders/decoders, etc - what settings do we need to be aware of for
BigInt
with babel, next, cra, and other builders/bundlers
cc @Zetazzz
That's great