Loosing ability to add more than one join/where/etc call when using a generic type definition

Hi, I struggle a bit with getting the types correct for this method using generics. The db variable is of type NodePgDatabase<Record<string, unknown>>. It seems like I'm not able to chain more than one join. The error I get is
Property 'leftJoin' does not exist on type 'Omit<PgSelectKind<PgSelectKind<PgSelectHKT, "activities", AppendToResult<"activities", T extends undefined ? { id: PgColumn<{ name: "id"; tableName: "activities"; dataType: "string"; columnType: "PgUUID"; ... 5 more ...; baseColumn: never; }, {}, {}>; ... 27 more ...; updatedById: PgColumn<...>; } : T, "companies", ...'.
Property 'leftJoin' does not exist on type 'Omit<PgSelectKind<PgSelectKind<PgSelectHKT, "activities", AppendToResult<"activities", T extends undefined ? { id: PgColumn<{ name: "id"; tableName: "activities"; dataType: "string"; columnType: "PgUUID"; ... 5 more ...; baseColumn: never; }, {}, {}>; ... 27 more ...; updatedById: PgColumn<...>; } : T, "companies", ...'.
This is working if I do not use the generics type T and just provide the fields directly.
No description
1 Reply
bjorbrat
bjorbratOP9mo ago
TS Playground - An online editor for exploring TypeScript and JavaS...
The Playground lets you write TypeScript or JavaScript online in a safe and sharable way.
Want results from more Discord servers?
Add your server