drizzle-zod returns properties as optional and `unknown`

i'm trying to get something work with @hono/zod-openapi and i am using drizzle to manage my postgres. when i use the following, drizzle-zod seems to return unknown types for properties and I am a bit stumped...
import { createSchemaFactory } from 'drizzle-zod';
import { z } from '@hono/zod-openapi';
const { createSelectSchema } = createSchemaFactory({ zodInstance: z });

const client = createSelectSchema(clients)
type Foo = z.infer<typeof client>;
import { createSchemaFactory } from 'drizzle-zod';
import { z } from '@hono/zod-openapi';
const { createSelectSchema } = createSchemaFactory({ zodInstance: z });

const client = createSelectSchema(clients)
type Foo = z.infer<typeof client>;
the output for the type is...
type Foo = {
[x: string]: any;
id?: unknown;
created_at?: unknown;
updated_at?: unknown;
tenant_id?: unknown;
jurisdiction?: unknown;
company_name?: unknown;
company_number?: unknown;
status?: unknown;
correlation_id?: unknown;
}
type Foo = {
[x: string]: any;
id?: unknown;
created_at?: unknown;
updated_at?: unknown;
tenant_id?: unknown;
jurisdiction?: unknown;
company_name?: unknown;
company_number?: unknown;
status?: unknown;
correlation_id?: unknown;
}
this isn't of any use. this also happens if i use straight drizzle-zod without using the factory. is there anything i am missing here? any help would be greatly appreciated.
1 Reply
Joe
JoeOP2mo ago
ok, i resolved this, im working in a mono-repo and i had conflicting tsconfig files. ive consolidated on a route tsconfig file...

Did you find this page helpful?