MarvinKR
MarvinKR
Explore posts from servers
DTDrizzle Team
Created by MarvinKR on 7/19/2024 in #help
Error Handling for Null Values in Drizzle-Zod + Shadcn Form (React-Hook-Form)
Thanks for the fix! You rock
23 replies
DTDrizzle Team
Created by MarvinKR on 7/19/2024 in #help
Error Handling for Null Values in Drizzle-Zod + Shadcn Form (React-Hook-Form)
Yeah!
23 replies
DTDrizzle Team
Created by MarvinKR on 7/19/2024 in #help
Error Handling for Null Values in Drizzle-Zod + Shadcn Form (React-Hook-Form)
The beauty of "full-stack", I suppose haha.
23 replies
DTDrizzle Team
Created by MarvinKR on 7/19/2024 in #help
Error Handling for Null Values in Drizzle-Zod + Shadcn Form (React-Hook-Form)
Ah yeah that was my temporary fix haha.
23 replies
DTDrizzle Team
Created by MarvinKR on 7/19/2024 in #help
Error Handling for Null Values in Drizzle-Zod + Shadcn Form (React-Hook-Form)
Yeah if the user doesn't mention the founding year in the form we store it as null
23 replies
DTDrizzle Team
Created by MarvinKR on 7/19/2024 in #help
Error Handling for Null Values in Drizzle-Zod + Shadcn Form (React-Hook-Form)
and the Phone component surprisingly isn't having an issue despite phone not having notNull() in my db
23 replies
DTDrizzle Team
Created by MarvinKR on 7/19/2024 in #help
Error Handling for Null Values in Drizzle-Zod + Shadcn Form (React-Hook-Form)
All fields that don't have notNull() in my db schema
23 replies
DTDrizzle Team
Created by MarvinKR on 7/19/2024 in #help
Error Handling for Null Values in Drizzle-Zod + Shadcn Form (React-Hook-Form)
Here is my react hook form
23 replies
DTDrizzle Team
Created by MarvinKR on 7/19/2024 in #help
Error Handling for Null Values in Drizzle-Zod + Shadcn Form (React-Hook-Form)
I did this but it's not changing the error:
// Schema for inserting a company - can be used to validate API requests
export const insertCompanySchema = createInsertSchema(companies, {
email: (schema) => schema.email.email(),
websiteUrl: (schema) => schema.websiteUrl.optional(),
foundingYear: (schema) => schema.foundingYear.optional(),
description: (schema) => schema.description.optional(),
logoUrl: (schema) => schema.logoUrl.optional(),
phone: (schema) => schema.phone.optional(),
address: (schema) => schema.address.optional(),
country: (schema) => schema.country.optional(),
city: (schema) => schema.city.optional(),
score: (schema) => schema.score.optional(),
}).omit({
id: true,
createdAt: true,
});
// Schema for inserting a company - can be used to validate API requests
export const insertCompanySchema = createInsertSchema(companies, {
email: (schema) => schema.email.email(),
websiteUrl: (schema) => schema.websiteUrl.optional(),
foundingYear: (schema) => schema.foundingYear.optional(),
description: (schema) => schema.description.optional(),
logoUrl: (schema) => schema.logoUrl.optional(),
phone: (schema) => schema.phone.optional(),
address: (schema) => schema.address.optional(),
country: (schema) => schema.country.optional(),
city: (schema) => schema.city.optional(),
score: (schema) => schema.score.optional(),
}).omit({
id: true,
createdAt: true,
});
23 replies
DTDrizzle Team
Created by MarvinKR on 9/16/2023 in #help
Issue with Drizzle-Zod: Due to a type mismatch between the ZodObject and ZodType types.
Very strange, it works with npm i drizzle-zod but not bun add drizzle-zod
35 replies
DTDrizzle Team
Created by MarvinKR on 9/16/2023 in #help
Issue with Drizzle-Zod: Due to a type mismatch between the ZodObject and ZodType types.
No description
35 replies
DTDrizzle Team
Created by MarvinKR on 9/16/2023 in #help
Issue with Drizzle-Zod: Due to a type mismatch between the ZodObject and ZodType types.
I did but the error is still there, do I need to delete package.json as well?
35 replies
DTDrizzle Team
Created by MarvinKR on 9/16/2023 in #help
Issue with Drizzle-Zod: Due to a type mismatch between the ZodObject and ZodType types.
"drizzle-orm": "^0.28.6",
35 replies
DTDrizzle Team
Created by MarvinKR on 9/16/2023 in #help
Issue with Drizzle-Zod: Due to a type mismatch between the ZodObject and ZodType types.
I have "zod": "^3.22.2" and "drizzle-zod": "^0.5.1",
35 replies
DTDrizzle Team
Created by MarvinKR on 9/16/2023 in #help
Issue with Drizzle-Zod: Due to a type mismatch between the ZodObject and ZodType types.
Did you use the CLI?
35 replies
DTDrizzle Team
Created by MarvinKR on 9/16/2023 in #help
Issue with Drizzle-Zod: Due to a type mismatch between the ZodObject and ZodType types.
I was using @gookerloober Kiramase CLI (https://github.com/nicoalbanese/kirimase) and thought it would work out of the box. But will update it now based on Hugo’s solution. Thanks!
35 replies
DTDrizzle Team
Created by MarvinKR on 9/16/2023 in #help
Issue with Drizzle-Zod: Due to a type mismatch between the ZodObject and ZodType types.
The readonly() method is not available on the ZodObject type. It's available on the ZodType class, which is the base class for all Zod schemas. The createSelectSchema and createInsertSchema functions I'm using to create updateMediaSchema and insertMediaSchema are returning ZodObject instances, not ZodType instances. That's why I'm getting an error when I try to call readonly() on these schemas. Unfortunately, Zod doesn't provide a built-in way to convert a ZodObject to a ZodType. Does anyone got a suggestion on how to fix this? @justhugo saw you had a similar issue using Drizzle-Zod?
35 replies