You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The library will make any column that has notNull: true be required. I had played around with ignoring it when a default value is set too, however that wasn't working out. If you're able to improve the experience of Infer, please do open a pull 🙂
For now, if you want to ignore a particular key, I'd use Omit<UserChats, 'id'> to remove it from the type.
It is possible, and that's what happens when notNull is falsey. It's rather difficult to extend that type to pick up default values, which is the only reason it doesn't currently
I am trying to use d1-orm and the model setup.
I created a model:
My expectation is that then, I can infer the type and it'd know that the
id
field is kind of optional for inserts and stuff like that?But doing
type UserChats = Infer<typeof models.user_chats>
Followed by a definition if said object:
Shows the type error:
I'd hoped that this would just work? Am I missing something? Do I have to update my code somehow to be able to use types with that?
The text was updated successfully, but these errors were encountered: