TypeScript complaining about using a spread operator in partial select query
TypeScript complaining about me using a spread operator in partial select query.
I have the following query joining data on two tables,
userData
and users
. The query works as intended on the client side but TypeScript is complaining about me using a spread operator ...userData,
(line 3) with TS2345: Argument of type [...] is not assignable to parameter of type SelectedFields
I am using "drizzle-orm": "^0.28.6"
4 Replies
You're not supposed to spread the table directly like that. Gut you can use the
getTableColumns
helper: https://orm.drizzle.team/docs/goodies#get-typed-table-columnsGoodies - DrizzleORM
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind
Oh thank you so much, didn't know about this helper! This works now.
I've almost switched to the query API even if the query doesn't include joins!
My issue has been resolved.