Skip to content

fix: 🐛 declare the dependencies whose types the SDK exposes - #1669

Merged
polymesh-bot merged 1 commit into
developfrom
declare-type-dependencies
Sep 8, 2026
Merged

fix: 🐛 declare the dependencies whose types the SDK exposes#1669
polymesh-bot merged 1 commit into
developfrom
declare-type-dependencies

Conversation

@F-OBrien

@F-OBrien F-OBrien commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Description

Three packages that src/ imports directly were never declared as dependencies:

Package Import sites in src/
@polkadot/types 380
@polkadot/types-codec 15
@polkadot/rpc-core 2

They resolve today only because @polkadot/api depends on them and package managers hoist them to the top of node_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. EventRecord is re-exported from @polkadot/types/interfaces as 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/api pin and the versions the overrides block 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.js moves from 9.0.1 to ^9.0.1. BigNumber is re-exported from the SDK's entry point, and its _isBigNumber member is declared private (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 a resolutions pin to force dedupe. This is the type-level half of the same duplication problem the BigNumber.isBigNumber change fixed at runtime.

Note that the caret does move the resolved version, 9.0.19.3.1, so this is not a pure range widening.

Verification

  • yarn build:ts — passes
  • yarn test:no-cov209 suites, 2728 tests, all passing on bignumber.js 9.3.1

Breaking Changes

None. No source changed, and no @polkadot/* resolved version moves.

bignumber.js resolves to 9.3.1 rather than 9.0.1. The intervening releases are bug fixes and packaging changes — the only API addition is BigInt argument support in 9.2.0 — and the full suite passes against it.

JIRA Link

Checklist

  • Updated the Readme.md (if required) ?

@F-OBrien
F-OBrien requested a review from a team as a code owner September 7, 2026 14:51
@socket-security

socket-security Bot commented Sep 7, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedbignumber.js@​9.0.1 ⏵ 9.3.1100100100 +185 -6100

View full report

`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.
@sonarqubecloud

sonarqubecloud Bot commented Sep 8, 2026

Copy link
Copy Markdown

@F-OBrien

F-OBrien commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

/fast-forward

@polymesh-bot
polymesh-bot merged commit d59b063 into develop Sep 8, 2026
17 checks passed
@polymesh-bot
polymesh-bot deleted the declare-type-dependencies branch September 8, 2026 15:05
@polymesh-bot

Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 31.1.0-beta.11 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants