autobotkilla
Explore posts from serversIs there a way to execute an ExpressionBuilder?
Hmmm. I'm trying to create reusable select queries so that the same shape can be returned in different circumstances. Do you have an alternative suggestion?
Here's an example.
This way I can get the same Job object when I select a job directly or include a Job in another query, like getting a JobApplication.
I'm looking for a way to define reusable shapes.
8 replies
Problems typing a generic withPerson helper
Here's a repro on Kysely playground https://kyse.link/?p=s&i=8gXYLeE8i8LQVeEFSjsv
9 replies
Problems typing a generic withPerson helper
I'm trying to make it so that any table that has a foreign key to the person table can load the same person data, but pass in the column reference for that table. For example, Message.senderId or Project.ownerId both point to the person table.
9 replies
Problems typing a generic withPerson helper
So I tried making the function more generic.
This fixes the typescript error when I call the function, but messes up the typing inside the function on the .whereRef and .select calls.
Argument of type 'string' is not assignable to parameter of type 'ReferenceExpression<TDB, TTB | ("Person" extends keyof TDB ? keyof TDB & "Person" : never)>'.
I just can't seem to figure this out. I'd really appreciate any help.
9 replies