Missing Refine type after update

Seem like with a recent release of drizzle-zod, we lost an exported type (namely Refine) to satisfy types in a single place. Anyone know of a better way to do this so we don't need to repeat code? And maybe any way we can export the Refine type (seems like its BuildRefine now 🤔)?
import type { Refine } from 'drizzle-zod';
import { teamsTable } from '../teams-table';

const refineSchema = {
name: ({ name }) => name.min(3).max(50),
} satisfies Refine<typeof teamsTable, 'select'>;

export const insertSchema = createInsertSchema(teamsTable, refineSchema);
export const selectSchema = createSelectSchema(teamsTable, refineSchema);
import type { Refine } from 'drizzle-zod';
import { teamsTable } from '../teams-table';

const refineSchema = {
name: ({ name }) => name.min(3).max(50),
} satisfies Refine<typeof teamsTable, 'select'>;

export const insertSchema = createInsertSchema(teamsTable, refineSchema);
export const selectSchema = createSelectSchema(teamsTable, refineSchema);
1 Reply
natedunn
natedunnOP•2mo ago
Ok well, BuildRefine works perfectly for me, but its not exported. I will try to get a PR in to fix that. Until then, I worked around it by importing the file directly:
import type { BuildRefine } from 'node_modules/drizzle-zod/schema.types.internal.d.ts';
import type { BuildRefine } from 'node_modules/drizzle-zod/schema.types.internal.d.ts';

Did you find this page helpful?