walletconnect-utils icon indicating copy to clipboard operation
walletconnect-utils copied to clipboard

Incorrect typing expectation for .getEntries() method

Open meeh0w opened this issue 1 year ago • 0 comments

Hi 👋

As I'm implementing a custom storage implementation for our needs, I noticed that the typing expectations for getEntries() method feels off:

public getEntries<T = any>(): Promise<[string, T][]>;

This method is supposed to return all objects stored by WalletConnect libs, which of course means that they will differ in shape. This means that we cannot pass a generic like so:

storage.getEntries<SomeType>();

and expect all of the entries returned to satisfy SomeType - some of them will contain session's data, while others will contain pairings, expirer metadata, etc.

I think this should be changed to:

public getEntries(): Promise<[string, unknown][]>;

meeh0w avatar Jul 26 '23 12:07 meeh0w