lanc3
lanc3
Explore posts from servers
DTDrizzle Team
Created by ethan! on 5/27/2024 in #help
Enums
otherwise drizzle will not pick it up
9 replies
DTDrizzle Team
Created by ethan! on 5/27/2024 in #help
Enums
You probably need to export that enum
9 replies
DTDrizzle Team
Created by Michael Schaufelberger on 5/12/2023 in #help
MySQL (Planetscale): Cannot read properties of undefined (reading 'name')
Just a small bump on this since I also encountered this issue and was confused for a while for the same reasons as OP. This seems to be a typescript issue? I.e. in my case this gives no error
await db
.update(workflows)
.set(input) // Drizzle zod schema validated but with relations (which was my issue). No type errors.
.where(eq(workflows.id, input.id));
await db
.update(workflows)
.set(input) // Drizzle zod schema validated but with relations (which was my issue). No type errors.
.where(eq(workflows.id, input.id));
but the following gives the correct type error
const {relation1, relation2, ...rest} = input;
await db
.update(workflows)
.set({relation1, relation2, ...rest}) // Error: Object literal may only specify known properties, and relation1 does not exist in type
.where(eq(workflows.id, rest.id));
const {relation1, relation2, ...rest} = input;
await db
.update(workflows)
.set({relation1, relation2, ...rest}) // Error: Object literal may only specify known properties, and relation1 does not exist in type
.where(eq(workflows.id, rest.id));
and removing the relation fields fixes both the type error and the error from drizzle. Perhaps then the best solution is to handle this error and throw a descriptive error from drizzle
34 replies