acronie
acronie
Explore posts from servers
DTDrizzle Team
Created by acronie on 12/19/2023 in #help
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
4 replies