supabase/realtime-js

Improve typings for channel presence state

agubler opened this issue · 0 comments

Chore

Describe the chore

A user can pass custom state properties via the presence API and since #224 it is now possible to pass a generic that will adjust the types accordingly.

channel.presenceState<MyPresenceState>();

However it would be useful if we could stamp the presence types on creation of the channel

const channel = client.channel<MyPresenceState>('id', config);

// would enforce track to `MyPresenceState`
channel.track({ ... });

// return presence state as `MyPresenceState`
const presenceState = channel.presenceState();

Additional context

Please let me know if this is more than a chore and needs to be recorded elsewhere.