Using drizzle-zod with superforms

I am working on a SvelteKit app where i use Drizzle (0.30.2), drizzle-zod (0.8.2) and Svelte superforms (2.27.1)

This is my drizzle SQLite schema:
export const dataset = sqliteTable('dataset', {
    id: integer('id').primaryKey(),
    name: text('name'),
    columnClasses: text('column_classes'),
    data: text('data'),
    createdAt: integer('created_at', { mode: "timestamp_ms" }).notNull().default(sql`(CURRENT_TIMESTAMP)`),
    updatedAt: integer('updated_at', { mode: "timestamp_ms" }).notNull().default(sql`(CURRENT_TIMESTAMP)`)
});

And i try to create a zod schema with
import { createSelectSchema } from 'drizzle-zod';
...
export const datasetZodSchema = createSelectSchema(dataset);


When i import this into a different file, and try to use it with
import { superValidate } from 'sveltekit-superforms';
import { zod } from 'sveltekit-superforms/adapters';
import { datasetZodSchema } from '$lib/server/db/schema/dataset.js';
...
form: await superValidate(zod(datasetZodSchema)),

I get the error:
Argument of type 'BuildSchema<"select", { id: SQLiteColumn<{ name: "id"; tableName:...' 

is not assignable to parameter of type 'ZodObjectType'.


What am i doing wrong here? All the examples i am finding use it like this.
Was this page helpful?