Infer TS types with `sql` operator and `db.execute`
result.rows
is of type ExecutedQuery.rows: Row[]
Is there a way to tell ts that it's of Type Todo[]
?2 Replies
do you use postgres? mysql? sqlite?
I'm using mysql currently as I'm integrating with planetscale. In the docs it mentions
sql<T>
not being able to perform any runtime mapping, which I understand and is fine. I just couldn't quite figure out how/if I could use a generic on execute<T>. In my example using execute<Todo>
doesn't seem to affect the type of result.rows Row[]
For example in kysely I can do:
Is it possible to do something similar in drizzle?