Typescript additional fields date type error
Jumping straight to example:
Add additional fields in the db schema and in the auth config
Expected behavior
Error I'm getting:
It is reading date types as undefined in better-auth
This error only occurs with type date, any other type in better-auth config is read correctly
Add additional fields in the db schema and in the auth config
user: {
additionalFields: {
birthday: { type: 'string', default: null },
dob: { type: 'date', default: null },
},
},Expected behavior
await updateUser({
birthday: values.birthday?.toISOString(),
dob: values.birthday && values.birthday,
})Error I'm getting:
Type 'Date | undefined' is not assignable to type 'undefined'. (dob field)It is reading date types as undefined in better-auth
This error only occurs with type date, any other type in better-auth config is read correctly