Unifying a JSON column's return type with `drizzle-zod`'s `Json`
By default,
drizzle-zod gives json columns in a table the Json type and schema, a utility type it defines (unexported) in the library. Drizzle itself, however, returns a never value when querying for the value of a json column unless you use the .$type function to give it a type explicitly. What's the best way to bridge this gap such that drizzle-zod generated schema matches the query's returned type while losing as little type safety as possible?1 Reply
My current solution is doing
.$type<object>