c0ldh4ck
c0ldh4ck
DTDrizzle Team
Created by c0ldh4ck on 1/29/2024 in #help
Help with Drizzle-zod
Hi all, Working with SvelteKit I have a types/index.ts file in my lib folder. I want to create Schema and Types for zod validations for forms this way: import { createInsertSchema, createSelectSchema } from 'drizzle-zod'; import { locations } from '$lib/server/database/schema'; export const insertLocationSchema = createInsertSchema(locations); export const selectLocationSchema = createSelectSchema(locations); export type insertLocationType = typeof insertLocationSchema; export type selectLocationType = typeof selectLocationSchema; I am getting an error that I cannot import server side code into client side components, which I understand. But I have my schema and all other DB relatated setup in $lib/server folder. How would I manage to use these types in for example a 'Create Location Form' component? I am using sveltekit-superforms and returning that via a +page.server.ts, I am a bit confused. Hopefully someone has some experience with SvelteKit and this
2 replies