Closed wbhob closed 4 months ago
+1
Running into this with a similar schema setup as well
Not a fix but for the time being you can use this util for type-safety.
export function getCountFromForeignTable(column: unknown) {
const _column = (Array.isArray(column) ? column[0] : column) as {
count?: number;
};
return _column.count ?? null;
}
+1, seeing this too
Note: This is a duplicate of #447 and #479.
Let's close this in favour of #447 and track there.
Bug report
Describe the bug
The bug is a mismatch between generated types and code behavior. The code below causes a TypeScript error despite functioning correctly.
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
Create tables using Supabase hosted with the following schemas:
create index if not exists organization_members_user_id_idx on public.organization_members using btree (user_id) tablespace pg_default;
create index if not exists organization_members_organization_id_idx on public.organization_members using hash (organization_id) tablespace pg_default;