supabase / realtime-js

An isomorphic Javascript client for Supabase Realtime server.

Home Page:https://supabase.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow .on broadcast listen to be able to cast type T

kyeshmz opened this issue · comments

Chore

Describe the chore

Currently, if you want to cast what the payload would be for a .on broadcast with a T type, it automatically becomes a postgres_changes for the type. I would like to type what kind of type a payload is broadcasted with to a certain event name.

I want to do something like

export interface RealtimeType {
  type: REALTIME_LISTEN_TYPES
  event: string
  payload?: any
  [key: string]: any
}

export interface GameStateRealtime extends RealtimeType {
  payload: {
    gameState: GameState
  }
}

Additional Info

Screenshot 2023-10-19 at 8 02 35 PM

Thank you for reporting. Released today

supabase/supabase-js#893