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

Functions do not recon with config.number when converting a string into a numeric type #3206

Open
josdejong opened this issue May 29, 2024 · 0 comments

Comments

@josdejong
Copy link
Owner

It's a bit of an edge case, but for example:

math.config({number: 'BigNumber'})
math.add('2', '3')
// results in a number with value 5, but should be a BigNumber with value 5

The reason is that functions like add do not have a signature like add(string, string). Therefore, automatic conversion kicks in. The automatic conversion finds a conversion from string -> number that fits the bill and uses that, without reconing with the configured config.number. I'm not sure how a proper solution to fix this would look like, since the type conversions are static 🤔.

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

No branches or pull requests

1 participant