Getting types for update query

Similar to $inferInsert, is there a $inferUpdate to get types while performing a db.update()
Solution:
Like Partial<typeof users.$inferInsert>
Jump to solution
7 Replies
Angelelz
Angelelz12mo ago
You can use $inferInsert for updates.
vr7bd
vr7bdOP12mo ago
Sorry for the late reply but yeah I was using it but then, if you don't have the values that are not nullable, lsp starts complaining.
Angelelz
Angelelz12mo ago
That's expected behavior. If the value is not nullable you need to provide it
vr7bd
vr7bdOP12mo ago
Yeah but when you're trying to update, it's not necessary right
Angelelz
Angelelz12mo ago
You're right, in that case I would suggest the Partial utility type.
Solution
Angelelz
Angelelz12mo ago
Like Partial<typeof users.$inferInsert>
vr7bd
vr7bdOP12mo ago
Alright thanks I'll give it a shot! Yup it worked !
Want results from more Discord servers?
Add your server