Dr. Sauce
Type of query result is {}[]
Hi all! Loving using Kysely at the moment, it's super easy to use.
I ran into one problem, which I believe is probably a lack of understanding from myself around certain elements of TypeScript or Kysely itself.
Here is the DB Schema from
kysely-codegen
:
Here is a simplified version of a query (which is without any type errors). It also returns the results correctly from the DB:
I noticed that results
has the type {}[]
. I expected the result to be aware of what fields are contained in the returned objects.
Is there something specific I need to do in order to have the results array typed?
Or should I be casting it to a type I create myself?
Many thanks for your help!!!14 replies