Skip to content

Fix protocols type in PartySocketOptions to accept ProtocolsProvider#372

Merged
threepointone merged 3 commits into
mainfrom
fix/protocols-type
Apr 20, 2026
Merged

Fix protocols type in PartySocketOptions to accept ProtocolsProvider#372
threepointone merged 3 commits into
mainfrom
fix/protocols-type

Conversation

@threepointone
Copy link
Copy Markdown
Collaborator

Summary

  • Widens PartySocketOptions.protocols from string[] to ProtocolsProvider, matching the type already accepted by the underlying ReconnectingWebSocket constructor.
  • This allows users to pass null, a single string, a string[], a sync function, or an async function — all of which the runtime already supports.

Fixes #371

Test plan

  • Full type-check passes across all 41 projects (npm run check:type)
  • No lint errors introduced
  • Existing tests already cover the various ProtocolsProvider variants at the ReconnectingWebSocket level (see reconnecting.test.ts — "websocket sync protocolsProvider", "websocket async protocolsProvider")
  • The usePartySocket hook inherits its type from PartySocketOptions, so it also benefits from this fix automatically

Made with Cursor

The `protocols` field was typed as `string[]` but the underlying
ReconnectingWebSocket already supports the full ProtocolsProvider
type (null, string, string[], sync/async functions). This widens
the public type to match the runtime capability.

Fixes #371

Made-with: Cursor
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 20, 2026

🦋 Changeset detected

Latest commit: 10cf44a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
partysocket Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 20, 2026

Open in StackBlitz

hono-party

npm i https://pkg.pr.new/cloudflare/partykit/hono-party@372

partyfn

npm i https://pkg.pr.new/cloudflare/partykit/partyfn@372

partyserver

npm i https://pkg.pr.new/cloudflare/partykit/partyserver@372

partysocket

npm i https://pkg.pr.new/cloudflare/partykit/partysocket@372

partysub

npm i https://pkg.pr.new/cloudflare/partykit/partysub@372

partysync

npm i https://pkg.pr.new/cloudflare/partykit/partysync@372

partytracks

npm i https://pkg.pr.new/cloudflare/partykit/partytracks@372

partywhen

npm i https://pkg.pr.new/cloudflare/partykit/partywhen@372

y-partyserver

npm i https://pkg.pr.new/cloudflare/partykit/y-partyserver@372

commit: 10cf44a

Regenerate package-lock.json to update and normalize inconsistent "peer": true entries across dependency records. This is a lockfile-only change produced by the package manager; no source code was modified.
@threepointone threepointone merged commit bb6ab6f into main Apr 20, 2026
6 checks passed
@threepointone threepointone deleted the fix/protocols-type branch April 20, 2026 18:30
@github-actions github-actions Bot mentioned this pull request Apr 20, 2026
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.

Wrong protocols type in public PartySocketOptions

1 participant