Defining types for default values in createSelectSchema
In my users table schema for a Turso DB, I've got a field of
settings: text('settings', { mode: 'json' })
. I'd like to define the defaults outside of the schema definition, so this doesn't potentially change the database and require a migration when I need new setting values, but I also want to type this field in my app.
So I have a userSettingsSchema and want to set the default via createSelectSchema's options:
However, under UserData, settings is still null or my UserSettings type. Wouldn't my userDataSchemaOptions
have narrowed that down?
It looks like I can force it more explicitly like this:
0 Replies