matthewblewitt
matthewblewitt
DTDrizzle Team
Created by matthewblewitt on 6/29/2023 in #help
Infer TS types with `sql` operator and `db.execute`
Is it possible to do something similar in drizzle?
5 replies
DTDrizzle Team
Created by matthewblewitt on 6/29/2023 in #help
Infer TS types with `sql` operator and `db.execute`
For example in kysely I can do:
const result = await sql<Todo[]>`select * from todo`.execute(db)
const result = await sql<Todo[]>`select * from todo`.execute(db)
5 replies
DTDrizzle Team
Created by matthewblewitt on 6/29/2023 in #help
Infer TS types with `sql` operator and `db.execute`
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[]
5 replies