supabase / realtime-js

An isomorphic Javascript client for Supabase Realtime server.
https://supabase.com
MIT License
324 stars 58 forks source link

Improve and enrich exported types #159

Open slaesh opened 2 years ago

slaesh commented 2 years ago

Feature request

I have no clue what's the current state of this lib, maybe this would come later on.. But the exported types should be improved and enriched.

For example:

Currently the interface for the RealtimeChannel's on call could be easily improved.

https://github.com/supabase/realtime-js/blob/05d098c228d4303151d58448bf3e05cfb1c77225/src/RealtimeChannel.ts#L125

Instead of

on(type: string, filter?: { [key: string]: string }, callback?: Function) {}

we should go with this:

on(type: string, callback: Function, filter?: { [key: string]: string })
  1. why register a listener without a callback? so make it mandatory..
  2. since point 1, move the optional filters at the end
  3. it would be great not to use just Function.. What about making it typed instead? =)
w3b6x9 commented 2 years ago

exported types should be improved and enriched

@slaesh absolutely agree with you.

We're planning some big changes to this client lib and will improve the types. Will incorporate some of the feedback you've given here.

w3b6x9 commented 2 years ago

@slaesh don't want you to think we've forgotten about this. We'll be working on types in the next few weeks. Apologies on the delay!