I have the following Typescript interface 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;
};
}
This interface must not be modified as it is auto-generated.
I usually use it like this on queries:
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 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 tried creating the interface but it gives me TS error:
interface UserContentCombo extends definitions["Content"] {
...definitions["Users"]
}
what is the correct syntax? Thanks