Open
Description
Feature request
Is your feature request related to a problem? Please describe.
The types generated by the CLI should have multiple interfaces/types instead of nested types to improve usability.
Currently we have to use createClient<Database>(...)
and for explicitly typing return types we have to use Database['public']['Tables']['...']['Row']
Describe the solution you'd like
By giving us multiple defined types/interfaces we could just use TodoTableRow
or TodoTableInsert
for example.
type PartialRequired<T, K extends keyof T> = Partial<T> & Pick<T, K>;
export type Json =
| string
| number
| boolean
| null
| { [key: string]: Json }
| Json[];
export interface Database {
public: {
Tables: Tables;
Functions: {};
}
}
export interface ProfilesTable {
id: string;
created_at: string | null;
updated_at: string | null;
installation_id: number | null;
name: string | null;
}
export interface Tables {
profiles: {
Row: ProfilesTable;
Insert: PartialRequired<ProfilesTable, 'id'>;
Update: Partial<ProfilesTable>;
};
}