© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•3y ago•
3 replies
acronie

Type error when passing schema to drizzle

export const db: PostgresJsDatabase = drizzle(queryClient, {
    schema: schema,
    logger: true,
})
export const db: PostgresJsDatabase = drizzle(queryClient, {
    schema: schema,
    logger: true,
})
I am passing my schema like this
 │     Type 'PostgresJsDatabase<typeof import("/Users/mooy/Desktop/projects/tracker/apps/api/src/db/schema/schema")>' is not assignable to type 'PostgresJsDatabase'. typescript (2322) [7, 14]
 │        The types of '_.schema' are incompatible between these types. 
 │          Type 'ExtractTablesWithRelations<typeof import("/Users/mooy/Desktop/projects/tracker/apps/api/src/db/schema/schema")> | undefined' is not assignable to type 'ExtractTablesWithRelations<Record<string, never>> | undefined'. 
 │            Type 'ExtractTablesWithRelations<typeof import("/Users/mooy/Desktop/projects/tracker/apps/api/src/db/schema/schema")>' is not assignable to type 'ExtractTablesWithRelations<Record<string, never>>'. 
 │              Property 'key' is incompatible with index signature. 
 │                Type '{ tsName: "key"; dbName: "user_key"; columns: { id: PgColumn<{ name: "id"; tableName: "user_key"; dataType: "string"; columnType: "PgVarchar"; data: string; driverParam: string; notNull: true; hasDefault: false; enumValues: [...]; baseColumn: never; }, {}, {}>; userId: PgColumn<...>; hashedPassword: PgColumn<...>; }...' is not assignable to type '{ tsName: string; dbName: never; columns: never; relations: Record<string, Relation<string>>; primaryKey: AnyColumn[]; }'. 
 │                  Types of property 'dbName' are incompatible. 
 │                    Type 'string' is not assignable to type 'never'. 
 │     Type 'PostgresJsDatabase<typeof import("/Users/mooy/Desktop/projects/tracker/apps/api/src/db/schema/schema")>' is not assignable to type 'PostgresJsDatabase'. typescript (2322) [7, 14]
 │        The types of '_.schema' are incompatible between these types. 
 │          Type 'ExtractTablesWithRelations<typeof import("/Users/mooy/Desktop/projects/tracker/apps/api/src/db/schema/schema")> | undefined' is not assignable to type 'ExtractTablesWithRelations<Record<string, never>> | undefined'. 
 │            Type 'ExtractTablesWithRelations<typeof import("/Users/mooy/Desktop/projects/tracker/apps/api/src/db/schema/schema")>' is not assignable to type 'ExtractTablesWithRelations<Record<string, never>>'. 
 │              Property 'key' is incompatible with index signature. 
 │                Type '{ tsName: "key"; dbName: "user_key"; columns: { id: PgColumn<{ name: "id"; tableName: "user_key"; dataType: "string"; columnType: "PgVarchar"; data: string; driverParam: string; notNull: true; hasDefault: false; enumValues: [...]; baseColumn: never; }, {}, {}>; userId: PgColumn<...>; hashedPassword: PgColumn<...>; }...' is not assignable to type '{ tsName: string; dbName: never; columns: never; relations: Record<string, Relation<string>>; primaryKey: AnyColumn[]; }'. 
 │                  Types of property 'dbName' are incompatible. 
 │                    Type 'string' is not assignable to type 'never'. 
but it returns this error
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

drizzle schema type error
Drizzle TeamDTDrizzle Team / help
2y ago
Drizzle Typescript Init with Schema Type Error
Drizzle TeamDTDrizzle Team / help
3y ago
Type error when using `drizzle-zod` with sqlite table schema
Drizzle TeamDTDrizzle Team / help
9mo ago
Error when pushing schema programmatically using drizzle-kit
Drizzle TeamDTDrizzle Team / help
3w ago