Prepare statement throws type error for enums. How to get type safety for prepared values
the status column in the schema is an enum like so:
and even type casting the placeholder does not work
is there a proper way to get type safety in general for prepared statements?
Love the performance gains, but really bums me out that I loose all safeguards regarding types ๐
8 Replies
Check this typescript playground for a workaround
TS Playground - An online editor for exploring TypeScript and JavaS...
The Playground lets you write TypeScript or JavaScript online in a safe and sharable way.
Can create a new GH issue for this?
thanks, that works for now. I assume I didn't miss anything in the docs then and there is no better/type-safe way for prepared statements, like generics or something?
yea I can add an issue for this
We just need to add the placeholder type to the
mysqlEnum
typeok.
It would be cool in general to get some typesafety for the prepared statements, specially for the object that is passed to the
execute({...})
argument.There is an open issue for that, we just haven't been able to get to that one yet
GitHub
[BUG]:
sql.placeholder
throws type error for enums ยท Issue #1608 ...What version of drizzle-orm are you using? 0.29.1 What version of drizzle-kit are you using? 0.20.6 Describe the Bug sql.placeholder throws type error for enums. import { drizzle } from "drizz...