Skip to content
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

Seems like the types for many to many relationships are not working in v2 #355

Closed
mzalevski opened this issue Oct 16, 2022 · 3 comments
Closed
Labels
bug Something isn't working

Comments

@mzalevski
Copy link

mzalevski commented Oct 16, 2022

Consider following generated types:

export interface Database {
  public: {
    Tables: {
      users_skills: {
        Row: {
          user_id: string;
          skill_id: number;
        };
      };
      users: {
        Row: {
          id: string;
          created_at: string;
          name: string | null;
        };
      };
      skills: {
        Row: {
          id: number;
          created_at: string;
          name: string;
        };
      };
    };
  };
}

when I try to supabase.from("users").select("*,skills(*)") I get

{
    id: string;
    created_at: string;
    name: string | null;
} & {
    skills: unknown;
}

I tried some things from the postgrest docs but nothing is working. Am I doing something wrong or is this inference not ready yet?

@mzalevski mzalevski added the bug Something isn't working label Oct 16, 2022
@mzalevski mzalevski changed the title Seems like the types for many to many relationships are working in v2 Seems like the types for many to many relationships are not working in v2 Oct 16, 2022
@steve-chavez steve-chavez transferred this issue from supabase/supabase-js Oct 18, 2022
@soedirgo
Copy link
Member

Hey there, typings for embedded tables is still a WIP, but we have a PR that allows you to override the return type.

@mzalevski
Copy link
Author

Thanks @soedirgo. I'll be waiting then :)

@soedirgo
Copy link
Member

Closing this as we've since added typings for embedded tables

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

2 participants