json object relation null problem
I am trying to make https://kysely.dev/docs/recipes/relations this helper work, but get error
I wrote code following docs example:
usage:
and helper expression?:
adding union with
null
here:
fixes problem, but it looks like it should work without null
after adding .$notNull()
as above and later after select any clue?Relations | Kysely
Kysely IS NOT an ORM. Kysely DOES NOT have the concept of relations.
2 Replies
Solution
Never use
undefined
or ?
in your type interfaces.Alternatively the issue might be that
stawkaVatZakupuId
is nullable. You can't assign it to Expression<number>
If you know stawkaVatZakupuId
is not null, assert the reference. Not the return value of the query.