Property .on does not exist on supabase?

Trying to add a listener to realtime DB updates in a useEffect. Getting this error:

Property 'on' does not exist on type 'PostgrestQueryBuilder<any, any>'.ts(2339)

import { useSessionContext } from '@supabase/auth-helpers-react';

const Component() => {
const { session, supabaseClient } = useSessionContext();

useEffect(() => {
    const subs = supabaseClient
      .from("objects")
      .on("UPDATE", (payload) => {
        // dispatch(updateGameObject(payload.new.data));
      })
      .subscribe(console.log);
    subs.onClose(() => {
      console.log("on closed");
      supabase.removeAllSubscriptions();
    });
    return () => {
      subs.unsubscribe();
    };
  }
Was this page helpful?