Type error on insert

I'm trying to do a simple insert

await db.insert(receipt).values({
            userId: locals.user.id,
            typeId: 1,
            date: entry.tanggal,
            name: entry.keterangan,
            nominal: entry.nominal,
            note: entry.catatan || '',
            statusId: 1
        });


The schema is like this

export const receipt = mysqlTable('receipt', {
    id: serial('id').primaryKey(),
    userId: int('user_id').notNull(),
    typeId: int('type_id').notNull(),
    name: varchar('name', { length: 100 }),
    date: date('date').notNull(),
    nominal: decimal('nominal', { precision: 10, scale: 2 }).notNull(),
    note: text('note'),
    statusId: int('status_id').notNull(),
    createdAt: timestamp('created_at').defaultNow().notNull()
});


It shows error

No overload matches this call.
  Overload 2 of 2, '(values: { date: Date | SQL<unknown> | Placeholder<string, any>; userId: number | SQL<unknown> | Placeholder<string, any>; typeId: number | SQL<unknown> | Placeholder<...>; ... 5 more ...; note?: string | ... 3 more ... | undefined; }[]): MySqlInsertBase<...>', gave the following error.
    Object literal may only specify known properties, and 'userId' does not exist in type '{ date: Date | SQL<unknown> | Placeholder<string, any>; userId: number | SQL<unknown> | Placeholder<string, any>; typeId: number | SQL<unknown> | Placeholder<...>; ... 5 more ...; note?: string | ... 3 more ... | undefined; }[]'.


apparently it's because the type provided by drizzle is somehow an Array, or is there something that I didn't know or did wrong?
Was this page helpful?