Skip to content

fix(types): default TSignedTransaction generic to unknown#49

Merged
claudiovb merged 1 commit into
mainfrom
fix/default-tsigned-transaction
Jul 2, 2026
Merged

fix(types): default TSignedTransaction generic to unknown#49
claudiovb merged 1 commit into
mainfrom
fix/default-tsigned-transaction

Conversation

@AlonzoRicardo

Copy link
Copy Markdown
Contributor

Summary

IWalletAccount<TSignedTransaction> was made generic in 1.0.0-beta.12 (via #45) with no default type argument. Every bare IWalletAccount reference — inside this module's own .d.ts files, in @tetherto/wdk-wallet-evm, and in @tetherto/wdk-core — now fails to compile under any consumer's TypeScript project:

error TS2314: Generic type 'IWalletAccount<TSignedTransaction>' requires 1 type argument(s).

This blocks anything that consumes those .d.ts files, including the WDK docs TypeScript snippets we're preparing for the policy engine documentation.

Fix

Add a default unknown to the template parameter in src/wallet-account.js:

- * @template TSignedTransaction
+ * @template [TSignedTransaction=unknown]

Which emits as IWalletAccount<TSignedTransaction = unknown> in the .d.ts. Bare references (IWalletAccount without <...>) automatically resolve to IWalletAccount<unknown>, restoring compatibility with every existing call site.

Scope

  • 1 line of JSDoc in src/wallet-account.js
  • 1 line in types/src/wallet-account.d.ts (surgically edited to avoid unrelated regeneration drift — the rest of types/ is left as-is)

Non-goals

The rest of types/ shows drift when regenerated fresh under the pinned tsc 5.8.3 (interfaces emitted as classes, typedef imports rearranged, ~500 lines of noise). That's real but orthogonal to this fix — worth its own PR to run build:types on main and commit the clean baseline.

Test plan

  • npm run lint — clean
  • npm test — 19/19 passing
  • Verified .d.ts emits IWalletAccount<TSignedTransaction = unknown>
  • Verified downstream: overlaid into wdk-core/node_modules and re-ran the docs snippet TS check — the "requires 1 type argument(s)" errors are gone

Marked as draft

Opening as draft since this crosses module boundaries. Happy to iterate before it's marked ready for review.

IWalletAccount<TSignedTransaction> was made generic in
1.0.0-beta.12 with no default type argument. Every bare
`IWalletAccount` reference — inside this module's own
`.d.ts` files, in `@tetherto/wdk-wallet-evm`, and in
`@tetherto/wdk-core` — now fails to compile with
"requires 1 type argument(s)" under any TypeScript
project that consumes those `.d.ts` files.

Defaulting the parameter to `unknown` restores compatibility
with every existing bare reference (they resolve to
`IWalletAccount<unknown>`) without changing behavior for
call sites that already supply an explicit type argument.

No runtime change; JSDoc only. Committed types diff is
kept minimal — the rest of the `types/` folder is left
alone so this PR does not include unrelated regeneration
drift.
@claudiovb
claudiovb marked this pull request as ready for review July 2, 2026 12:49
@claudiovb
claudiovb merged commit 9dcf57d into main Jul 2, 2026
5 checks passed
Comment thread src/wallet-account.js

@Davi0kProgramsThings Davi0kProgramsThings left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants