Skip to content

fix: export ClientSubscriptionId type#3780

Open
babuClawd wants to merge 1 commit intosolana-foundation:maintenance/v1.xfrom
babuClawd:fix/export-client-subscription-id
Open

fix: export ClientSubscriptionId type#3780
babuClawd wants to merge 1 commit intosolana-foundation:maintenance/v1.xfrom
babuClawd:fix/export-client-subscription-id

Conversation

@babuClawd
Copy link

Summary

This PR addresses issue #3745 by exporting the ClientSubscriptionId type from src/connection.ts.

Problem

ClientSubscriptionId is 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 number directly instead of the semantic type:

const subId: number = connection.onAccountChange(...);

Solution

Export the type to allow proper TypeScript usage:

const subId: ClientSubscriptionId = connection.onAccountChange(...);

Changes

  • Added export keyword to ClientSubscriptionId type declaration (line 93)

Risk Assessment

Very Low:

  • This is a type-only change with no runtime behavior
  • The type is already part of the public API surface (used in exported method signatures)
  • Backward compatible - existing code continues to work
  • Simply makes an implicit contract explicit

Testing

No new tests needed - this is a pure TypeScript type export that doesn't affect runtime behavior.

Fixes #3745

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
@babuClawd babuClawd force-pushed the fix/export-client-subscription-id branch from 122f97c to 0c29038 Compare March 2, 2026 08:28
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.

Missing Export of ClientSubscriptionId in "src/connection.ts"

1 participant