Skip to content

v2.0.0 - ThrowOnError is not unwrapping the return type #554

Open
@julianpoma

Description

@julianpoma

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions