We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
Describe the bug The generated typescript types are incorrect when using nested embedding in a query. Gives the error:
`Property 'protertyName' does not exist on type 'SelectQueryError<"Referencing missing column 'propertyName'">[].`
To Reproduce Steps to reproduce the behavior:
create table public.recipes ( id bigint primary key generated always as identity, title text not null ); create table public.ingredients ( id bigint primary key generated always as identity, title text not null ); create table public.recipe_ingredients ( recipe bigint not null references recipes on update cascade on delete cascade, ingredient bigint not null references ingredients on update cascade, constraint recipe_ingredients_pkey primary key (one, two) );
npx supabase gen types typescript --local > /some/path/types.ts
const recipe = await supabase .from("recipes") .select("title, recipe_ingredients(ingredient(title))") .eq("id", id) .maybeSingle();
recipe.data.recipe_ingredients.map((recipe_ingredient) => recipe_ingredient.ingredient.title);
Expected behavior I expected the type to be string.
string
Screenshots
System information Rerun the failing command with --create-ticket flag.
--create-ticket
supabase services
SERVICE IMAGE │ LOCAL │ LINKED ─────────────────────────┼──────────────────────┼──────────── supabase/postgres │ 15.1.1.41 │ 15.1.1.41 supabase/gotrue │ v2.148.0 │ v2.148.0 postgrest/postgrest │ v12.0.2 │ v12.0.2 supabase/realtime │ v2.28.32 │ - supabase/storage-api │ v1.0.10 │ v1.0.10 supabase/edge-runtime │ v1.45.2 │ - supabase/studio │ 20240422-5cf8f30 │ - supabase/postgres-meta │ v0.80.0 │ - supabase/logflare │ 1.4.0 │ - bitnami/pgbouncer │ 1.20.1-debian-11-r39 │ - darthsim/imgproxy │ v3.8.0 │ -
Additional context If applicable, add any other context about the problem here.
The text was updated successfully, but these errors were encountered:
Hey there !
I couldn't reproduce the issue on my end. I've tried it with the following setup (had to change the sql as it wasn't valid):
create table public.recipes ( id bigint primary key generated always as identity, title text not null ); create table public.ingredients ( id bigint primary key generated always as identity, title text not null ); create table public.recipe_ingredients ( recipe bigint not null references recipes on update cascade on delete cascade, ingredient bigint not null references ingredients on update cascade, constraint recipe_ingredients_pkey primary key (recipe, ingredient) );
Which generated the following types after introspection:
ingredients: { Row: { id: number title: string } Insert: { id?: never title: string } Update: { id?: never title?: string } Relationships: [] } recipe_ingredients: { Row: { ingredient: number recipe: number } Insert: { ingredient: number recipe: number } Update: { ingredient?: number recipe?: number } Relationships: [ { foreignKeyName: "recipe_ingredients_ingredient_fkey" columns: ["ingredient"] isOneToOne: false referencedRelation: "ingredients" referencedColumns: ["id"] }, { foreignKeyName: "recipe_ingredients_recipe_fkey" columns: ["recipe"] isOneToOne: false referencedRelation: "recipes" referencedColumns: ["id"] }, ] } recipes: { Row: { id: number title: string } Insert: { id?: never title: string } Update: { id?: never title?: string } Relationships: [] }
Then reproducing the mentioned selection here I got expected type inference:
You can find the MRE I've used here: supabase/postgrest-js@master...avallete/mre-837-test Let me know if this is still an issue for you @timbovelander with the latest versions of postgres-meta (in the MRE it's 0.87.1) and supabase-js/postgrest-js.
postgres-meta
supabase-js
postgrest-js
Sorry, something went wrong.
No branches or pull requests
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
The generated typescript types are incorrect when using nested embedding in a query. Gives the error:
`Property 'protertyName' does not exist on type 'SelectQueryError<"Referencing missing column 'propertyName'">[].`
To Reproduce
Steps to reproduce the behavior:
npx supabase gen types typescript --local > /some/path/types.ts
Expected behavior
I expected the type to be
string
.Screenshots

System information
Rerun the failing command with
--create-ticket
flag.supabase services
command]Additional context
If applicable, add any other context about the problem here.
The text was updated successfully, but these errors were encountered: