postgrest-js icon indicating copy to clipboard operation
postgrest-js copied to clipboard

!inner should make the relation non-nullable

Open wyozi opened this issue 1 year ago • 0 comments

Describe the bug

When a relation has the !inner hint, the relationship can be considered to always exist due to the embedded resource being included as an inner join. Therefore, null can be dropped from the result type union.

To Reproduce

const test = supabase().from("people").select("id, site:sites!inner(name)").then(r => r.data);
/* type:
{
    id: string;
    site: {
        name: string | null;
    } | null;
}
*/

Expected behavior

const test = supabase().from("people").select("id, site:sites!inner(name)").then(r => r.data);
/* type:
{
    id: string;
    site: {
        name: string | null;
    };
}
*/

wyozi avatar Aug 08 '23 11:08 wyozi