drizzle-zod not infering jsonb type properly

I have the following table
export const dataQueryRun = pgTable('data_query_run', {
    ...
    parameters: jsonb('parameters').notNull().$type<Record<string, unknown>>(),
        ...
});

And i use drizzle-zod to do the following types:
const selectDataQueryRunSchema = createSelectSchema(dataQueryRun, {
    logs: z.array(z.string())
});
export type TDataQueryRun = z.infer<typeof selectDataQueryRunSchema>;

I get this:
type TDataQueryRun = {
   ...
    parameters: ((string | number | boolean | {
        [key: string]: Json;
    } | Json[]) & (string | ... 4 more ... | undefined)) | null;
}


instead of this:
type TDataQueryRun = {
   ...
    parameters: Record<string,unknown>
}


Does anybody know why and how to fix this?
Was this page helpful?