Below is the Typescript interface that has been generated by Supabase
export interface definitions {
Users: {
/** Format: uuid */
id: string;
/**
* Format: timestamp with time zone
* @default now()
*/
created_at?: string;
/**
* Format: uuid
* @description Note:
* This is a Primary Key.<pk/>
*/
};
Content: {
/**
* Format: uuid
* @description Note:
* This is a Primary Key.<pk/>
*/
id: string;
/**
* Format: timestamp with time zone
* @default now()
*/
created_at?: string;
/** Format: text */
name: string;
/** Format: text */
description: string;
};
}
It is important not to modify this auto-generated interface.
Usually, I utilize it in queries like this:
import { definitions } from "../types/supabase";
const id = 1
let { data, error } = await supabase
.from<definitions["Users"]>("Users").select("created_at")
.eq("id", id);
However, for this particular query, I need to extend my interface:
let { data: Content, error } = await supabase
.from<ContentAndUsers>("Content")
.select(`*, Users (id, created_at)`)
.eq("id", id);
I have attempted to create the interface, but it results in a TS error:
interface UserContentCombo extends definitions["Content"] {
...definitions["Users"]
}
Could you please provide guidance on the correct syntax? Thank you