left join not properly hydrating results

tx
          .select({
            ...getTableColumns(projects),
            clients: { id: clients.id, name: clients.name },
          })
          .from(projects)
          .leftJoin(clients, eq(clients.id, projects.clientId))

The query this generates is correct:

select "projects"."id", "projects"."created_at", "projects"."updated_at", "projects"."organization_id", "projects"."name", "projects"."client_id", "clients"."id", "clients"."name" from "projects" left join "clients" on "clients"."id" = "projects"."client_id"


And running this query also returns the clients name, as expected. But the resulting object says clients is null, whereas I am expecting an object with the id and name values set.

Why is this not hydrating?
Was this page helpful?