fix: 🐛 declare the dependencies whose types the SDK exposes - #1669
Merged
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
prashantasdeveloper
previously approved these changes
Sep 8, 2026
`src/` imports `@polkadot/types` in 380 places, `@polkadot/types-codec` in fifteen and `@polkadot/rpc-core` in two, and `EventRecord` is re-exported from `@polkadot/types/interfaces` as public API. None was a declared dependency — all three resolved only because `@polkadot/api` pulls them in and the package manager hoists them. That fails under an install that does not hoist, and where it does resolve the version is the consumer's rather than the one the SDK was built against. Declared at `16.5.2`, matching the `@polkadot/api` pin and what `overrides` already forced; no resolved version moves. `bignumber.js` was pinned to exactly `9.0.1`. `BigNumber` is re-exported from the entry point and its `_isBigNumber` member is `private`, so the class is nominally typed: two copies are two incompatible types, and no runtime check can bridge them. `^9.0.1` lets a consumer dedupe to one 9.x and drop the `resolutions` pin this forced. The type-level half of the problem `BigNumber.isBigNumber` fixed at runtime.
F-OBrien
force-pushed
the
declare-type-dependencies
branch
from
September 8, 2026 14:35
cf8e299 to
d59b063
Compare
|
prashantasdeveloper
approved these changes
Sep 8, 2026
Contributor
Author
|
/fast-forward |
Collaborator
|
🎉 This PR is included in version 31.1.0-beta.11 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Three packages that
src/imports directly were never declared as dependencies:src/@polkadot/types@polkadot/types-codec@polkadot/rpc-coreThey resolve today only because
@polkadot/apidepends on them and package managers hoist them to the top ofnode_modules. That breaks under any install that does not hoist — pnpm's default layout, or Yarn PnP — and where it does resolve, the version is whatever the consumer's tree happens to supply rather than the one the SDK was built and tested against.EventRecordis re-exported from@polkadot/types/interfacesas part of the public API, so this reaches the published type surface as well as the build.All three are now declared at
16.5.2— exact, matching the existing@polkadot/apipin and the versions theoverridesblock already forced. Deliberately not carets: the@polkadot/*packages pin each other exactly on purpose, and a minor bump can desynchronise them from@polymeshassociation/polymesh-types. No resolved version changes; the lockfile diff is three added descriptors.Separately,
bignumber.jsmoves from9.0.1to^9.0.1.BigNumberis re-exported from the SDK's entry point, and its_isBigNumbermember is declaredprivate(bignumber.js/types.d.ts:329), which makes the class nominally typed — two copies of the package are two incompatible types to TypeScript regardless of whether the code is identical, and no runtime check can bridge that. An exact pin guaranteed a second copy for any consumer on another 9.x, who then had to add aresolutionspin to force dedupe. This is the type-level half of the same duplication problem theBigNumber.isBigNumberchange fixed at runtime.Note that the caret does move the resolved version,
9.0.1→9.3.1, so this is not a pure range widening.Verification
yarn build:ts— passesyarn test:no-cov— 209 suites, 2728 tests, all passing onbignumber.js9.3.1Breaking Changes
None. No source changed, and no
@polkadot/*resolved version moves.bignumber.jsresolves to 9.3.1 rather than 9.0.1. The intervening releases are bug fixes and packaging changes — the only API addition isBigIntargument support in 9.2.0 — and the full suite passes against it.JIRA Link
Checklist