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](https://private-user-images.githubusercontent.com/12763472/276589423-9a08b1cf-477e-4b7f-bdbb-4ff61862d79a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MDc0NTEwOTEsIm5iZiI6MTcwNzQ1MDc5MSwicGF0aCI6Ii8xMjc2MzQ3Mi8yNzY1ODk0MjMtOWEwOGIxY2YtNDc3ZS00YjdmLWJkYmItNGZmNjE4NjJkNzlhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDAyMDklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwMjA5VDAzNTMxMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTVhYWIyYzUzMDRiNmQ1N2FmMTMxMWE2Y2M3MzdhMGQ4NjgxYzBkOTEyOTJlODNkYWMyY2Q5YzRkMTM2MDczMzUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.0vVrJHT2C0TZ4jeSQFKi6-dc7ohdDPIg9vCMvNxz8L0)
Thank you for reporting. Released today