This repository was archived by the owner on Mar 5, 2025. It is now read-only.
Bump @types/bn.js dependency to 5.1.1 #5640
Closed
+32,770
−4,862
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR sets a higher minimum version for the @types/bn.js dependency. In version 5.1.1, a new divmod function was added which is a breaking change on a patch version number release: a type defined from an import of @types/bn.js@v5.1.1 is not compatible with the BN type if defined from an import of @types/bn.js@v5.1.0.
Because the current loose specification allows either version to be used, sometimes NPM picks different versions for different web3 package or even for the same package directly vs. when included in another web3 package. This incompatibility causes code that previously worked fine due to type consistency to now fail compilation. Pinning all to .0 exactly would be less likely to cause breaking changes elsewhere or in the future, as maintainers of the typing package seem to not recognize this breaking change as such and could do something similar in the future. However, pinning to .0 would likely cause greater incompatibilities unless all projects which use web3 and have type interaction with the BN type also pin to .0 specifically, and the
^
notation is more common. As long as everything is consistent, it works, and failing forward makes a little more sense.Type of change
Checklist for 1.x:
npm run dtslint
with success and extended the tests and types if necessary.npm run test:cov
and my test cases cover all the lines and branches of the added code. [n/a and ERROR: The filename, directory name, or volume label syntax is incorrect.]npm run build
with success.dist/web3.min.js
in a browser.CHANGELOG.md
file in the root folder.