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();


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

export const supabaseAdmin = createClient<Database>(
  environment.supabaseURL,
  environment.supabseServiceKey
);
Was this page helpful?