supabase-js icon indicating copy to clipboard operation
supabase-js copied to clipboard

v2.0.0 - ThrowOnError is not unwrapping the return type

Open julianpoma opened this issue 4 years ago • 1 comments

Bug report

Describe the bug

The errors are not being unwrapped when calling throwOnError

On a simple model definition like this one:

export interface Database {
  public: {
    Tables: {
      profiles: {
        Row: {
          id: string
          username: string | null
          email: string | null
        }
        Insert: {}
        Update: {}
      }
    }
    Views: {}
    Functions: {}
    Enums: {}
  }
}

const supabase = createClient<Database>(...)


const { data } = await supabaseAdmin
  .from('profiles')
  .select(`*`)
  .throwOnError()

The return type of data is Profile[] | undefined, as you can see on the picture

image

Expected behavior

When unwrapping the error, the return type should be Table[].

System information

  • Supabase version: V2.0.0 rc@10

julianpoma avatar Sep 20 '22 15:09 julianpoma

Thank you for opening this issue @julianpoma ! I will be closing this issue now, since it's 3 years old, and a lot of things have changed in the library. If you find that the issue persists, please add a comment here with details, and I'll be happy to investigate and reopen! Thank you for understanding!

mandarini avatar Sep 05 '25 14:09 mandarini