supabase / postgrest-js

Isomorphic JavaScript client for PostgREST.
https://supabase.com
MIT License
964 stars 128 forks source link

!inner should make the relation non-nullable #456

Closed wyozi closed 3 months ago

wyozi commented 10 months ago

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;
    };
}
*/
github-actions[bot] commented 3 months ago

:tada: This issue has been resolved in version 1.14.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: