I have some issues using drizzle as a package infering the types
Context:
I have a monorepo using turbo, pnpm, honojs and drizzle.
I have a server application and a package called database which exports the database client and the schemas
When I import on this way:
import * as schemas from '../schemas';
And import the createDatabaseClient
method the db instance returns me this type:
When I import on this way: import { schemas } from '../schemas';
using an object with the schemas.
And import the createDatabaseClient
method the db instance returns me this type:
There's a way to not use the schemas object?
2 Replies
I got the same issue. You have to import schemas as an object, not as a global export.
Type the return of the function createDatabaseClient as:
export type Drizzle = NodePgDatabase<typeof schema> & { $client: NodePgClient; } I think it will work.
Type the return of the function createDatabaseClient as:
export type Drizzle = NodePgDatabase<typeof schema> & { $client: NodePgClient; } I think it will work.


hmm I'm going to try that! thanks