© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•7mo ago•
1 reply
MrGentle

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)`)
});
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);
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)),
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'.
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.
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Using drizzle-zod on zod-based form
Drizzle TeamDTDrizzle Team / help
7mo ago
Drizzle-zod combined with regular zod? 🙃
Drizzle TeamDTDrizzle Team / help
15mo ago
Drizzle Zod with relations
Drizzle TeamDTDrizzle Team / help
2y ago
Help with Drizzle-zod
Drizzle TeamDTDrizzle Team / help
3y ago