[object Object] on custom type

Using Turso I have this column definition: information: text('information').$type<MeritInformation>(), Where the type is defined by:
type MeritInformation = {
title: string;
};
type MeritInformation = {
title: string;
};
However, when I insert data in the column:
const insert = await db
.insert(meritsTable)
.values({ type: 2, userId: 1, slug: 'test23', information: { title: 'test' } })
.execute();
const insert = await db
.insert(meritsTable)
.values({ type: 2, userId: 1, slug: 'test23', information: { title: 'test' } })
.execute();
The content of information is [object Object]
No description
2 Replies
Sillvva
Sillvva•8mo ago
Try text('information', { mode: 'json' }).$type<MeritInformation>()
Martin Carlsson
Martin CarlssonOP•8mo ago
@Sillvva It worked!!! Thank you so much 🎉
Want results from more Discord servers?
Add your server