Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export RoomEventCallbacks type #1361

Open
mallison opened this issue Jan 6, 2025 · 1 comment
Open

Export RoomEventCallbacks type #1361

mallison opened this issue Jan 6, 2025 · 1 comment

Comments

@mallison
Copy link

mallison commented Jan 6, 2025

Describe the problem

I've added room event logging to my TypeScript LiveKit application -- I capture each event and serialize the callback arguments and save to a datastore.

[
  {
    event: "participantConnected",
    args: [serializedParticipant]
  },
  // etc ...
]

To type the event log, It would have been very useful if RoomEventCallbacks was exported.

I could have then derived the type for the event log from it (TypeScript playground PoC)

For the moment, I'm maintaining my own list of events and arguments. Eg.

type Connected = BaseEvent<RoomEventName.Connected>;

type Reconnecting = BaseEvent<RoomEventName.Reconnecting>;

type Disconnected = BaseEvent<RoomEventName.Disconnected> & {
  reason?: DisconnectReason;
};

type TrackPublished = BaseEvent<RoomEventName.TrackPublished> &
  ParticipantSerialized &
  TrackSerialized;

// etc ...

Describe the proposed solution

I would like to see RoomEventCallbacks exported so user-land code has access to the typed parameters for each event callback.

Alternatives considered

No response

Importance

would make my life easier

Additional Information

No response

@mallison
Copy link
Author

mallison commented Jan 7, 2025

This would also be useful to properly type the emit method of the mock Room class I'm using in some tests.

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

No branches or pull requests

1 participant