Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
julianpoma opened this issue Sep 20, 2022 · 0 comments
Open

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

julianpoma opened this issue Sep 20, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@julianpoma
Copy link

julianpoma commented Sep 20, 2022

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 julianpoma added the bug Something isn't working label Sep 20, 2022
@julianpoma julianpoma changed the title v2.0.0 - The return type of a basic select operation should not be Table[] | undefined. v2.0.0 - ThrowOnError is not unwrapping the return type Sep 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant