Skip to content

⚡️ Use PeerID type in presence#4

Open
Clindbergh wants to merge 2 commits intoSchoolAI:mainfrom
Clindbergh:peer-id-type
Open

⚡️ Use PeerID type in presence#4
Clindbergh wants to merge 2 commits intoSchoolAI:mainfrom
Clindbergh:peer-id-type

Conversation

@Clindbergh
Copy link
Copy Markdown
Contributor

@Clindbergh Clindbergh commented Dec 19, 2025

What do you think about using the PeerID type in the presence interface (instead of string)?


Note

Switches presence and handle peer identifiers to the PeerID type for stronger typing.

  • Change PresenceInterface.peers to Map<PeerID, ObjectValue> and update imports
  • Update TypedDocHandle.peerId and UntypedDocHandle.peerId types to PeerID
  • Adjust UntypedDocHandle presence peers getter to return Map<PeerID, ObjectValue> (casts from entries)

Written by Cursor Bugbot for commit fb7f14b. This will update automatically on new commits. Configure here.

for (const [peerId, value] of Object.entries(allStates)) {
if (peerId !== myPeerId) {
result.set(peerId, value)
result.set(peerId as PeerID, value)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed because Object.entries looses types. I am a fan of ts-extras for this case.

@Clindbergh
Copy link
Copy Markdown
Contributor Author

I also added the use of PeerID in the doc handles.

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