© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago•
1 reply
InspectorT

Types for channel subscriptions

Hi! What's the recommended best way for getting types in the callback for a channel subscription?

  supabaseAdmin
    .channel('public:parties')
    .on(
      'postgres_changes',
      { event: 'INSERT', schema: 'public', table: 'parties' },
      (payload) => {
        console.log('new party', payload.record); // how to type this function?
      }
    )
    .subscribe();
  supabaseAdmin
    .channel('public:parties')
    .on(
      'postgres_changes',
      { event: 'INSERT', schema: 'public', table: 'parties' },
      (payload) => {
        console.log('new party', payload.record); // how to type this function?
      }
    )
    .subscribe();


I am already passing in the generated
Database
Database
definition when instantiating the supabase client

export const supabaseAdmin = createClient<Database>(
  environment.supabaseURL,
  environment.supabseServiceKey
);
export const supabaseAdmin = createClient<Database>(
  environment.supabaseURL,
  environment.supabseServiceKey
);
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Channel subscriptions no longer auto resubscribing
SupabaseSSupabase / help-and-questions
7mo ago
Unknown Error on Channel for realtime subscriptions after updating to latest libraries
SupabaseSSupabase / help-and-questions
6mo ago
Paid subscriptions question
SupabaseSSupabase / help-and-questions
4mo ago
Generated Types for Dart
SupabaseSSupabase / help-and-questions
13mo ago