Closed probablykabari closed 2 months ago
Unfortunately it's not feasible to fix this. We'd need to carry around extra information throughout Kysely types to fix this.
A known issue, but won't fix for now at least.
You can create your own helper that works for your use cases though.
All good, I figured it would be difficult to type.
In the above, the typescript type is incorrect for the result of the
json_agg
function call because with aleft join
the values inside the json array can be[ null ]
if there are no records in the join. To resolve this you need to add.filterWhere("another_table.id", "is not", null)
, which would make the result of the agg justnull
, however this type is also incorrect in the library.This is just a type issue, the query works as expected.