You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
for the inferred/without explicitly defined types, every column is optional unknown, which seems counter intuitive
possibly related to the incorrect type mapping but i'm unable to replicate, i'm seeing a text column being given the type of string | string[]. the column above it in the definition has the type of string[] as it's a json column.
The text was updated successfully, but these errors were encountered:
Case 2: adding an unused parameter somehow fixes name
exportconstschema2=createInsertSchema(users,{// provide parameter to method but don't use itpermissions: (unused)=>permissionsSchema});schema2.shape.name// z.ZodOptional<z.ZodNullable<z.ZodString>>
Case 3: without providing custom schema to permissions...
Report hasn't been filed before.
What version of
drizzle-orm
are you using?0.38.0
What version of
drizzle-kit
are you using?0.0.0
Other packages
drizzle-zod@0.6.0
Describe the Bug
https://stackblitz.com/edit/vitejs-vite-nu1nvhap?file=src%2Fmain.ts
typescript 5.7.2
tsconfig (monorepo): https://gist.github.com/kylekz/806cf0d9e4ba5467b995b57e727884f8
createInsertSchema
andcreateUpdateSchema
infer/map types from the database schema incorrectlyi've added four types in the stackblitz:
for the explicitly defined ones, it's mapping
JSONContent
from thevalue
column onto the other columnsfor the inferred/without explicitly defined types, every column is optional unknown, which seems counter intuitive
possibly related to the incorrect type mapping but i'm unable to replicate, i'm seeing a
text
column being given the type ofstring | string[]
. the column above it in the definition has the type ofstring[]
as it's a json column.The text was updated successfully, but these errors were encountered: