fix: export ClientSubscriptionId type#3780
Open
babuClawd wants to merge 1 commit intosolana-foundation:maintenance/v1.xfrom
Open
fix: export ClientSubscriptionId type#3780babuClawd wants to merge 1 commit intosolana-foundation:maintenance/v1.xfrom
babuClawd wants to merge 1 commit intosolana-foundation:maintenance/v1.xfrom
Conversation
ClientSubscriptionId is used as the return type of public subscription methods (onAccountChange, onProgramAccountChange, onSlotChange, etc.) and as a parameter type for listener removal methods, but was not exported. This prevents TypeScript consumers from referencing the type directly, forcing them to use 'number' instead. Export the type to improve TypeScript DX and align with the convention used for other public types in the same file. Fixes solana-foundation#3745
122f97c to
0c29038
Compare
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.
Summary
This PR addresses issue #3745 by exporting the
ClientSubscriptionIdtype fromsrc/connection.ts.Problem
ClientSubscriptionIdis currently used as a return type for multiple public subscription methods:onAccountChange()onProgramAccountChange()onSlotChange()onSignature()onLogsSubscribe()It's also used as a parameter type for:
removeAccountChangeListener(id: ClientSubscriptionId)removeSlotChangeListener(id: ClientSubscriptionId)However, the type is not exported, making it impossible for TypeScript users to reference it when storing subscription IDs.
Current Workaround
Users must use
numberdirectly instead of the semantic type:Solution
Export the type to allow proper TypeScript usage:
Changes
exportkeyword toClientSubscriptionIdtype declaration (line 93)Risk Assessment
Very Low:
Testing
No new tests needed - this is a pure TypeScript type export that doesn't affect runtime behavior.
Fixes #3745