Skip to content

fix(types): make getEntries return unknown instead of generic T#266

Open
Sushil-19 wants to merge 1 commit intoWalletConnect:masterfrom
Sushil-19:fix/getEntries-typing-clean
Open

fix(types): make getEntries return unknown instead of generic T#266
Sushil-19 wants to merge 1 commit intoWalletConnect:masterfrom
Sushil-19:fix/getEntries-typing-clean

Conversation

@Sushil-19
Copy link

@Sushil-19 Sushil-19 commented Mar 2, 2026

Summary

Fixes the incorrect typing of getEntries().

The previous signature exposed a generic <T>, which implied that all returned entries share the same type. Since the storage can contain heterogeneous values (sessions, pairings, metadata, etc.), this assumption is not guaranteed and therefore unsound.

Background

getEntries<T>() suggests that consumers can safely expect every stored value to conform to T. However, the underlying storage layer is type-agnostic and may return different object shapes depending on what was persisted.

This mismatch between the type contract and runtime behavior can lead to incorrect assumptions or unsafe downstream usage.

Changes

  • Removed the generic parameter from getEntries
  • Updated return type to:
    Promise<[string, unknown][]>
  • Removed unsafe casts (as [string, T]) in implementations
  • No runtime behavior changes

Scope

This PR strictly corrects the type definition to reflect actual storage behavior.
No changes were made to persistence logic, session handling, or storage flow.

All existing behavior remains unchanged.

@github-actions
Copy link

github-actions bot commented Mar 2, 2026

All contributors have signed the CTA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@Sushil-19
Copy link
Author

I have read the CTA Document and I hereby sign the CTA

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.

1 participant